Repository does not allow updating assets 解决方法

背景

  1. 在内网服务器上搭建nexus私服,并尝试在工程中直接使用‘mvn deploy’将本地项目打包,上传私服
  2. nexus版本3.6.0-02,通过安装过程,知道与nexus2.X有很大差别

问题

报错
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (deploy) on project light.inf: Failed to deploy artifacts: Could not transfer artifact com.xxx.game:light.inf:jar:1.0 from/to releases (http://192.168.10.xxx:8081/repository/maven-releases/): Failed to transfer file:
http://192.168.10.xxx:8081/repository/maven-releases/com/xxx/game/light.inf/1.0/light.inf-1.0.jar. Return code is: 400, ReasonPhrase: Repository does not allow updating assets: maven-releases. -> [Help 1]

解决

  1. 事先请确保nexus搭建正确,可以使用cmd执行带参数的mvn deploy命令成功上传一个jar来验证,cmd命令附上
    mvn deploy:deploy-file -DgroupId=com.test -DartifactId=test -Dversion=1.2 -Dpackaging=jar -Dfile=E:\workspace\test-1.2.jar -Durl=http://192.168.xx.xxx:8081/repository/maven-releases/ -DrepositoryId=releases
    当然,该命令能成功执行的前提是本地安装的mvn目录的conf/settings.xml中配置有id为releases的server
  2. 浏览器登录nexus管理界面–>设置图标–>Repository–>Repositories–>maven-releases–>Hosted–>请选择‘Allow redeploy’策略,默认是disable策略,然后保存。 请注意,不同版本的nexus,进入的路径可能有细微区别
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值