2013-04-22 69 views
0

我在使用Nexus和Maven時遇到了一些麻煩。 當我嘗試使用Nexus構建Maven項目時,Maven無法找到任何工件。我將此添加到Maven Settings:Nexus和Maven:訪問Maven Central Repo?

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

將Maven與Nexus連接起來。 Maven的中央回購也在Nexus的設置中定義

+0

你在使用什麼IDE或者你要使用命令行? – 2013-04-22 08:42:48

回答

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>