上传jar包到Maven仓库

进入 /Users/*****/app/common/service/facade  执行 mvn install 即可在target目录下打出jar包
执行以下命令即可将jar包上传到maven仓库
mvn clean install org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file \
-Durl=http://mvn.**.net/artifactory/content/repositories/xxx-Releases \
-DrepositoryId=devRepo \
-DgroupId=com.xx.xx \
-DartifactId=xx-common-service-facade \
-Dversion=1.0.0.20180316 \
-Dpackaging=jar \
-Dfile=target/xx-common-service-facade-1.0.0.20180316.jar \
-Dsources=target/xx-common-service-facade-1.0.0.20180316-sources.jar
 
上传jar包的过程中有身份验证,如果身份验证不通过会报以下错误
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file (default-cli) on project zappinfo-facade: Failed to deploy artifacts: Could not transfer artifact com.xx.xx:xx-facade:jar:2.0.1.20180314 from/to central (http://mvn.dev.xx.net/artifactory/content/repositories/xx-Releases): Failed to transfer file: http://mvn.dev.xx.net/artifactory/content/repositories/xx-Releases/com/x/zpaas/xx-facade/2.0.1.20180314/xx-facade-2.0.1.20180314.jar. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
 
此时需要在maven的配置文件中添加用户名和密码
 
/Users/xx/program/apache-maven-3.5.2/conf/settings.xml 中配置了maven仓库的用户名密码
  <servers>
     <server>
       <id>devRepo</id>
       <username>xx</username>
       <password>123456</password>
     </server>
</servers>
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值