2013-04-22 2 views
0

У меня есть проблемы с использованием Nexus и Maven. Когда я пытаюсь построить проекты с Maven с помощью Nexus, Maven не может найти артефакт. Я добавил это в Maven. Настройки:Nexus and Maven: Доступ к центральному репо Maven?

 <mirror> 
     <id>nexus</id> 
     <url>http://localhost:6060/nexus/content/groups/public</url> 
     <mirrorOf>central</mirrorOf> 
    </mirror> 

для подключения Maven к Nexus. Центральный Maven репо также определяется в настройках Nexus

+0

В какой IDE вы используете или вы идете в командной строке? –

ответ

1

На основании документации Nexus вы должны настроить файл settings.xml как следующее:

Самое главное, что mirrorOf содержит только одну звездочку, чтобы получить все запросы, перенаправленные на настроенный экземпляр Nexus.

<settings> 
    <mirrors> 
    <mirror> 
     <!--This sends everything else to /public --> 
     <id>nexus</id> 
     <mirrorOf>*</mirrorOf> 
     <url>http://localhost:8081/nexus/content/groups/public</url> 
    </mirror> 
    </mirrors> 
    <profiles> 
    <profile> 
     <id>nexus</id> 
     <!--Enable snapshots for the built in central repo to direct --> 
     <!--all requests to nexus via the mirror --> 
     <repositories> 
     <repository> 
      <id>central</id> 
      <url>http://central</url> 
      <releases><enabled>true</enabled></releases> 
      <snapshots><enabled>true</enabled></snapshots> 
     </repository> 
     </repositories> 
    <pluginRepositories> 
     <pluginRepository> 
      <id>central</id> 
      <url>http://central</url> 
      <releases><enabled>true</enabled></releases> 
      <snapshots><enabled>true</enabled></snapshots> 
     </pluginRepository> 
     </pluginRepositories> 
    </profile> 
    </profiles> 
    <activeProfiles> 
    <!--make the profile active all the time --> 
    <activeProfile>nexus</activeProfile> 
    </activeProfiles> 
</settings> 
1

Вы можете попробовать так:

<mirror> 
    <id>nexus-local</id> 
    <url>http://localhost:6060/nexus/content/groups/public/</url> 
    <mirrorOf>external:*</mirrorOf> 
</mirror> 
Смежные вопросы