mvn deploy命令上傳包


 cmd輸入命令

 mvn deploy:deploy-file -DgroupId=com.xy.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.4.0 -Dpackaging=jar -Dfile=E:\ojdbc14.jar -Durl=http://localhost:9090/nexus-2.2-01/content/repositories/thirdparty/ -DrepositoryId=thirdparty

 

可能出現問題的解決:

 

使用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錯誤。解決:到nexus后台把 Deployment Policy 設置成Allow Redeploy,

 

3.Nexus中 Releases倉庫Respository PolicySnapshot是“Release”
Snapshot倉庫Respository PolicySnapshot是“Snapshot” 如果設置反了或錯了也是無法部署的。

 

4.如果你Snapshot可以發布,但是releases卻發布不了,可能是<version>1.0-SNAPSHOT</version>類似這樣的,version中包含了-SNAPSHOT,所以release發布不了,

 

也會返回400錯誤。

 

 

Return code is: 401, ReasonPhrase: Unauthorized 沒有被授權操作倉庫
   檢查倉庫的設置,以及用戶名密碼配置。

 

 上傳jar

mvn deploy:deploy-file -DgroupId=org.codehaus.mojo -DartifactId=build-helper-maven-plugin -Dversion=1.9.1 -Dpackaging=jar -Dfile=C:\Users\xxxx\Desktop\build-helper-maven-plugin-1.9.1.jar -Durl=http://xxxx:8081/nexus/content/repositories/EMS/ -DrepositoryId=EMS

 

 上傳源碼包

mvn deploy:deploy-file -DgroupId=org.ems -DartifactId=openoffice-jodconverter -Dversion=3.0.5 -Dpackaging=jar  -Dclassifier=sources -Dfile=C:\Users\username\Desktop\openoffice-jodconverter-3.0.5-sources.jar -Durl=http://XXXXX:8081/nexus/content/repositories/EMS/ -DrepositoryId=EMS

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM