持续集成:上传第三方资源到 Nexus 私服

My GitHub Home Page

创建资源库

  • 访问 http://localhost:8081
  • 使用 admin / admin123 登录
  • 添加 hosted 资源库,取名为 maven-3rd
  • 将 maven-3rd 加入 maven-public 资源列表

配置私服账号

修改本地 Maven 的 settings.xml 文件:

<server>
  <id>root</id>
  <username>admin</username>
  <password>admin123</password>
</server>

上传

执行上传命令:

mvn deploy:deploy-file -DgroupId=xxx -DartifactId=xxx -Dversion=xxx -Dpackaging=jar \
    -Dfile=D:\xxx\xxx\xxx.jar \
    -Durl=http://localhost:8081/repository/maven-3rd/ \
    -DrepositoryId=root
  • -Dfile 为绝对路径
  • -Durl 为 maven-3rd 的地址
  • -DrepositoryId 为 settings.xml 中 server 标签的 id 值