使用mvn deploy把jar包上传到私有仓库

  |   0 评论   |   1,255 浏览

正常一般的做法是把包在 nexus 后台通过界面上传到3rd party库里面. 但是如果没有相关的权限的时候.只有通过命令行上传到你有权限的库.
官方手册: https://maven.apache.org/guides/mini/guide-3rd-party-jars-remote.html
注: 未详细研究. 仅作备忘.

Deploying a 3rd party JAR with a customized POM

If a POM is already existing for the 3rd Party JAR and you want to deploy it together with the JAR we should use the pomFile argument of the deploy-file goal. See sample below.

mvn deploy:deploy-file -DpomFile=<path-to-pom> \
  -Dfile=<path-to-file> \
  -DrepositoryId=<id-to-map-on-server-section-of-settings.xml> \
  -Durl=<url-of-the-repository-to-deploy>

# id-to-map-on-server-section-of-settings.xml 这个是配置了相关信息的仓库.
# url-of-the-repository-to-deploy , 你要上传的仓库的url地址. nexus的后台可以找到.
# 样例
mvn deploy:deploy-file -DpomFile=pom.xml \
  -Dfile=jieba-analysis-1.0.3-beta.jar \
  -DrepositoryId=nexus \
  -Durl=http://maven.zhenguanyu.com/content/repositories/releases/
  1. 参考一
  2. 官方文档
  3. 文档3

评论

发表评论


取消