maven 组件发布配置

本文介绍了如何将Java项目配置为发布到Maven私服,包括在pom.xml中添加发布配置以及在本地settings.xml中设置服务器账号密码。详细讲解了-SNAPSHOT版本与非-SNAPSHOT版本发布的目标库,并强调了私有库组件配置的重要性。
摘要由CSDN通过智能技术生成

1. 在要发布到maven私服的项目pom.xml加入下面配置

 
 
< distributionManagement >
     < repository >
         < id >huwo-local-releases</ id >
         < name >local-releases</ name >
         < url >http://bin.huwo.io/artifactory/libs-release-local</ url >
     </ repository >
     < snapshotRepository >
         < id >huwo-local-snapshots</ id >
         < name >local snapshots</ name >
         < url >http://bin.huwo.io/artifactory/libs-snapshot-local</ url >
     </ snapshotRepository >
</ distributionManagement >

当项目版本号后面带 -SNAPSHOT 的时候,会发布到 libs-snapshot-local 库,如果不带,会发布到 libs-release-local 库

2. 本地settings.xml文件加入server相关帐号密码配置

 
< servers >
     < server >
       < id >huwo-local-releases</ id >
       < username >release</ username >
       < password >xxxxxx</ password >
     </ server >
     < server >
       < id >huwo-local-snapshots</ id >
       < username >release</ username >
       < password >xxxxxxx</ password >
     </ server >
   </ servers >

 

使用私有库组件配置

在项目的pom.xml文件中加入下面配置

 
< repositories >
     < repository >
         < id >huwo-local-releases</ id >
         < name >Local repository</ name >
         < url >http://xxx/artifactory/libs-release-local</ url >
         < releases >< enabled >true</ enabled ></ releases >
         < snapshots >
             < enabled >false</ enabled >
         </ snapshots >
     </ repository >
     < repository >
         < id >huwo-local-snapshot</ id >
         < name >Local repository</ name >
         < url >http://xxx/artifactory/libs-snapshot-local</ url >
         < snapshots >
             < enabled >true</ enabled >
         </ snapshots >
     </ repository >
</ repositories >

 

maven会根据不同的依赖组件版本到不同库中下载组件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值