环境配置distributionManagement

在测试环境将api to maven时,总是会报下面的错

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project ts-distribution-biz: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]

英文不好,加上对maven了解不是很透彻,花了一上午的时间才解决,distributionManagement标签里没有repository元素导致,这之前我都不知道distributionManagement这个东西。。。下面来介绍下
我在本地开发好之后,需要将项目推到远程,一个公用的远程仓库,这样别人就可以调用你的api。
但maven怎么知道要推到哪个远程仓库呢,distributionManagement就是负责将jar包推到指定的远程仓库。

<distributionManagement>    
    <repository>    
      <id>nexus-releases</id>    
      <name>Nexus Release Repository</name>    
      <url>http://127.0.0.1:8080/nexus/content/repositories/releases/</url>    或者<url>${repo.internal.snapshots.url}</url>
    </repository>    
    <snapshotRepository>    
      <id>nexus-snapshots</id>    
      <name>Nexus Snapshot Repository</name>    
      <url>http://127.0.0.1:8080/nexus/content/repositories/snapshots/</url>    或者<url>${repo.internal.releases.url}</url>
    </snapshotRepository>    
  </distributionManagement>  

maven会区分release版本和snapshot版本,远程仓库也会对稳定版和snapshot版进行区分。
其实url在settings.xml文件中配置了,所以直接使用占位符就可以了。
http://blog.csdn.net/ichsonx/article/details/49679161

转载于:https://www.cnblogs.com/kivi170806/p/8193879.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值