Maven从Nexus获取构建以及上传构建方法

配置maven从Nexus获取构建

  1. 配置本地仓库地址如果不配置默认在user/.m2/路径下存储
    我不喜欢存储在c盘,所以设置在d盘
    localRepository>D:/softdata/maven-repo</localRepository>

  2. 在setings.xml配置mirror就可以从nexus远程仓库获取构建

 <mirror>
     <id>nexus</id>
     <name>group</name>
     <url>http://localhost:8081/repository/maven-group/</url>
     <mirrorOf>*</mirrorOf> //配置所有构建获取都通过nexus私服
 </mirror>
  1. 在settings.xml配置maven可以从仓库和插件仓库获取快照版本和发布版本
<profile>
  <id>nexus</id>
  <repositories>
    <id>nexus</id>
    <name>Nexus</name>
    <url>http://localhost:8081/repository/maven-group/</url>
    <snapshots><enabled>true</enabled></snapshots>
    <releases><enabled>true</enabled></releases>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
	  <id>nexus</id>
	  <name>Nexues</name>
	  <url>http://localhost:8081/repository/maven-group/</url>
	  <snapshots><enabled>true</enabled></snapshots>
	  <releases><enabled>true</enabled></releases>
    </pluginRepository>
  </pluginRepositories>
</profile>
 <activeProfiles>
   <activeProfile>nexus</activeProfile>
 </activeProfiles>
  1. 配置nexus服务验证,如果不配置有可能请求被拒绝
	<server>
      <id>nexus-snapshots</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
    <server>
      <id>nexus-release</id>
      <username>admin</username>
      <password>admin123</password>
    </server>

配置maven从Nexus上传构建

  1. 项目中配置发布管理,最好在聚合模块中配置,配置发布快照版本库以及发布版本库
<distributionManagement>
 	<snapshotRepository>
 		<id>nexus-snapshots</id>
 		<name>Nexus SnapShots Repository</name>
 		<url>http://localhost:8081/repository/maven-snapshots/</url>
 	</snapshotRepository>
 	<repository>
 		<id>nexus-release</id>
 		<name>Nexus Release Repository</name>
 		<url>http://localhost:8081/repository/maven-releases/</url>
 	</repository>
 </distributionManagement>
  1. 执行maven clean deploy就可以在nexus中看到了
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值