手机版
你好,游客 登录 注册
背景:
阅读新闻

使用Nexus搭建私服

[日期:2014-03-23] 来源:Linux社区  作者:Linux [字体:大 中 小]

私有仓库配置

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>

linux
相关资讯       Nexus 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款