maven-deploy失敗


昨天遇到的問題,mavne項目執行deploy的時候,出錯。提示

Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]

很直白,就是權限問題。

那就上網搜索,deploy的配置。其實要deploy到遠端私服,就兩點:

1:本地pom文件,配置

  <distributionManagement>
   <repository>
    <id>releases</id>
    <name>Internal Releases</name>
    <url>http://自己服務器地址:8081/nexus/content/repositories/releases</url>
   </repository>
  </distributionManagement>

2:maven的setting.xml配置

 <servers>
     <server>
       <id>releases</id>   <!-- 注意這里的id名字要和pom.xml里配置的名字保持一致 -->
       <username>deployment</username>
       <password>deployment</password>
     </server>
 </servers>

 

檢查下來,兩條都“符合”,我的天這腫么辦。於是再看。。。

最終發現,項目頂層有parent配置,parent配置中distributionManagement項的id是另一個名字。

so找不到對應server配置的用戶名、密碼。

但是再想想,我項目的pom.xml里已經配置了,為什么沒有抵掉parent里的配置呢。

 


免責聲明!

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



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