天天看點

maven deploy (私有庫) 401

從本地送出到nexus時候報錯:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project *: Failed to deploy artifacts: Could not transfer artifact *:jar:1.0 from/to releases (http:/***-server* /1.0/*-1.0.jar. Return code is: 401, ReasonPhrase:Unauthorized.

原來是沒有配置認證。

maven目錄conf的setting.xml裡,

  1. <servers>
  2. <server>  
  3.     <id>releases</id>  
  4.     <username>使用者名</username>  
  5.     <password>密碼</password>  
  6.   </server>  
  7.  <server>  
  8.   <id>snapshots</id>  
  9.   <username>使用者名</username>  
  10.   <password>密碼</password>  
  11.   </server>  
  12. </servers>  

在servers裡面加入自己建構的私有庫的賬号密碼(授權)

這樣就可以解決401問題