私有仓库配置
Nexus的索引与构件搜索
点击图5中列表上的“Public Repositories”行,在下方的“Configuration”中我们可以看到,在“Ordered Group Repositories”中包含了Release、Snapshots、3rd party、Central等仓库。
为了构建Nexus的Maven中央库索引,首先需要设置Nexus中Maven Cencal代理仓库下载远程索引,将“Download Remote Indexes”的值从默认值false改为true。如图7:
图7
点击“Save”后,点击左边的“Scheduled Tasks”链接,会出现图8界面,说明Nexus后台在下载Maven中央仓库的索引。
图8
如果没有出现图8界面,那么要在“Public Repositories”行右击,点击“Update Index”。
图9
在“Repositories”界面中,选择Browse Index选项卡,可以看到Maven中央仓库内容的树形结构,如图10。
图10
如果还是构建不成功,参考:
http://www.linuxidc.com/Linux/2014-03/98708.htm
http://www.linuxidc.com/Linux/2014-03/98709.htm
在左边的搜索框中输入“spring”关键字,会出现一大堆与spring相关的结果。
如果要对宿主仓库和代理仓库建立索引。只需要在对应的仓库上右击,从弹出的快捷菜单中选择“ReIndex”即可。
配置Maven从Nexus下载构件
在上面的基础上,我们可以用Nexus私服了。有2种方式:
1、在项目的POM中配置。
<repositories>
<repository>
<id>local_nexus</id>
<name>local_nexus</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>local_nexus</id>
<name>local_nexus</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>




