maven 使用命令发布jar包到私服nexus

maven 使用命令发布jar包到私服nexus

setting.xml的配置

这个配置表示,你的私服账号信息,并设置一个id,通过id来区别多个私服

    <server>  
      <id>nexus-snapshots</id>  
      <username>maven</username>  
      <password>sr@12345</password>  
    </server>

完整命令

mvn deploy:deploy-file -DgroupId=com.xiaomi -DartifactId=mipush-sdk -Dversion=2.2.19 -Dpackaging=jar -Dfile=MiPush_SDK_Server_2_2_19.jar -Durl=http://192.168.10.131:8081/repository/maven-releases/ -DrepositoryId=nexus-snapshots
  • Durl,可以在nexus 的 repository中找到地址,并复制粘贴,如果没看到,可能权限不够
  • DrepositoryId,前面配置的server里面的id

常见错误解析:

Return code is: 400, ReasonPhrase: Repository does not allow updating assets: maven-releases.
表示你要换一下版本号,这个版本已存在,不能更新

Return code is: 401
表示你的服务账号密码不对

Return code is: 405, ReasonPhrase: PUT
-Durl 地址有问题,和 put没有关系

猜你喜欢

转载自www.cnblogs.com/mojiruo/p/11495791.html