部署自己的构建至私服nexus

本文详细介绍了如何配置Maven以实现与Nexus私有仓库的集成部署,包括Maven的基本配置、Nexus的安装及设置、settings.xml的修改、pom文件的调整等步骤。

1、配置部署Maven

2、部署nexus(参考Nexus官方文档);

3、拷贝$M2_HOME/conf/settings.xml 至 $user/.m2/目录;

4、修改settings.xml文件:增加server配置

Xml代码  收藏代码
  1. < servers >   
  2.     ……  
  3.     < server >   
  4.         < id > nexus </ id >   
  5.         < username > admin </ username >   
  6.         < password > admin123 </ password >   
  7.     </ server >   
  8.     < server >   
  9.         < id > nexus-snapshot </ id >   
  10.         < username > admin </ username >   
  11.         < password > admin123 </ password >   
  12.     </ server >   
  13. </ servers >   

 此处的id将于pom文件中的repository.id 对应

5、修改pom文件:

Xml代码  收藏代码
  1. <!-- 设定使用Release插件发布的仓库服务器 如有Nexus私服, 取消注释并指向正确的服务器地址. -->   
  2.     < distributionManagement >   
  3.         < repository >   
  4.             < id > nexus </ id >   
  5.             < name > Team Nexus Release Repository </ name >   
  6.             < url > http://localhost:8081/nexus/content/repositories/releases </ url >   
  7.         </ repository >   
  8.         < snapshotRepository >   
  9.             < id > nexus-snapshot </ id >   
  10.             < name > Team Nexus Snapshot Repository </ name >   
  11.             < url > http://localhost:8081/nexus/content/repositories/snapshots </ url >   
  12.             < uniqueVersion > false </ uniqueVersion >   
  13.         </ snapshotRepository >   
  14.     </ distributionManagement >   

 注意:server.id == respository.id  --> respository.id 的认证会使用server.id 的口令

 

6、mvn clean deploy

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值