上传 jar 到本地仓库或 nexus maven 私服

上传 jar 至本地 maven 仓库

mvn install:install-file \
-Dfile=/home/tongweb-embed-7.0.E.2_P1.jar \
-DgroupId=com.tongtech -DartifactId=tongweb-embed \
-Dversion=7.0.E.2_P1 -Dpackaging=jar

参数:

  1. -Dfile jar 路径
  2. -DgroupId-DartifactId-Dversion 即依赖坐标

上传 jar 至 nexus maven 私服

mvn deploy:deploy-file -Dpackaging=jar \
-Dfile=/home/tongweb-embed-7.0.E.2_P1.jar \
-DgroupId=com.tongtech -DartifactId=tongweb-embed -Dversion=7.0.E.2_P1 \
-Durl=http://a.b.c/repository/myrepo -DrepositoryId=myrepo

参数:

  1. -Durl 私服中仓库地址,格式为 http://{your-host}/repository/{your-repo-name}
  2. -DrepositoryId 私服中仓库名

注意:使用时需在 maven 的 settings.xml 配置文件添加 nexus 仓库凭证信息,格式如下


<servers>
  <server>
      <id>{repo-name}</id>
      <username>{username}</username>
      <password>{password}</password>
  </server>
</servers>

posted @ 2023-03-01 10:37  egu0o  阅读(132)  评论(0编辑  收藏  举报