部署自己的构建至私服nexus

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

猜你喜欢

转载自marsvaadin.iteye.com/blog/1581327