mvn deploy Return code is: 400

 

原log为:

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project standalone-pom: Failed to deploy artifacts: Could not transfer artifact org.springframework:spring-web-reactive:jar:5.0.0.BUILD-20161108.121529-1 from/to archiva.internal (http://nexus.d.xiaomi.net/nexus/content/repositories/releases/): Failed to transfer file: http://nexus.d.xiaomi.net/nexus/content/repositories/releases/org/springframework/spring-web-reactive/5.0.0.BUILD-SNAPSHOT/spring-web-reactive-5.0.0.BUILD-20161108.121529-1.jar. Return code is: 400, ReasonPhrase: Bad Request.

 

使用mvn deploy发布到远程仓库时报错 Return code is: 400

可能出现这种的情况,原因有如下可能:

  • 1.nexus的repository分三种类型:Hosted、 Proxy和Virtual,另外还有一个repository group(仓库组)用于对多个仓库进行组合。部署的时候只能部署到Hosted类型的仓库中,如果是其他类型就会出现这个400错误。
  • 2.默认情况下部署构件到Releases仓库中有时也会出现400错误,这个原因就像上面提到的那样,Nexus中 Releases仓库默认的Deployment Policy是“Disable Redeploy”, 所以无论你在settings.xml文件中将server的username设置为deployment还是使用admin都是无 法部署的,就会出现这个400错误。
  • 3.Nexus中 Releases仓库Respository PolicySnapshot是“Release” ,Snapshot仓库Respository PolicySnapshot是“Snapshot” 如果设置反了或错了也是无法部署的。
  • 4.如果你Snapshot可以发布,但是releases却发布不了,可能是<version>1.0-SNAPSHOT</version>类似这样的,version中包含了-SNAPSHOT,所以release发布不了,也会返回400错误。

    我的问题就是第四种情况导致,找到原因后,就deploy成功了。

转载于:https://my.oschina.net/mindfind/blog/784142

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值