发布命令如下:
-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]
发布时报错:
[b]解决办法[/b]
需要在maven中的conf下的setting.xml中添加:
这儿id和发布的id一致。
再来一次就发布成功了。
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一致。
再来一次就发布成功了。
Maven部署文件至Nexus
本文介绍如何使用Maven命令将本地jar包部署到Nexus仓库,并解决部署过程中遇到的401未授权错误。文章详细展示了命令的各个参数含义及配置文件setting.xml中需要添加的内容。
601

被折叠的 条评论
为什么被折叠?



