mvn deploy Return code is: 400

 

原log爲:react

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.web

 

使用mvn deploy發佈到遠程倉庫時報錯 Return code is: 400spring

可能出現這種的狀況,緣由有以下可能:apache

  • 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成功了。maven

相關文章
相關標籤/搜索