Maven 发布自定义jar包到Nexus中

发布命令如下:
mvn deploy:deploy-file -DgroupId=ddd.util -DartifactId=ddd-util -Dversion=1.0 -Dpackaging=jar -Dfile=C:\Users\Administrator\Desktop\dddutil.jar -Durl=http://ip:port/nexus/content/repositories/thirdparty/ -DrepositoryId=thirdparty

-DgroupId 项目
-DartifactId 模块
-Dversion 版本号
-Dpackaging是打包方式
-Dfile 架包的本地路径
-Durl 是仓库地址。
-DrepositoryId=thirdparty 是你要发布到Nexus中哪个仓库下去。
注意这儿的id是你的nexus中Repositories中对应的库中configuration中的Repository ID。如下图:
[img]http://dl2.iteye.com/upload/attachment/0099/4696/3e0f9510-8b73-3a24-99e7-ce5e2b1b96c2.jpg[/img]

发布时报错:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default
-cli) on project standalone-pom: Failed to deploy artifacts: Could not transfer artifact ddb.util:dd
b-util:jar:1.0 from/to thirdparty (http://ip:port/nexus/content/repositories/thirdpa
rty/): Failed to transfer file: http://ip:port/nexus/content/repositories/thirdparty/ddb/
util/ddb-util/1.0/ddb-util-1.0.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 arti
cles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

[b]解决办法[/b]
需要在maven中的conf下的setting.xml中添加:
<server>
<id>thirdparty</id>
<username>账号</username>
<password>密码</password>
</server>

这儿id和发布的id一致。
再来一次就发布成功了。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值