1、具體報錯信息如下
Could not transfer artifact org.apache.curator:curator-recipes:pom:2.11.0 from/to nexus
(http://192.168.198.128:8081/repository/maven-public/): Not authorized
2、原因:在 settings.xml 的 mirrors 標簽只配置了私服的鏡像,而沒有在 servers 標簽中配置對應的用戶名和密碼
<mirror>
<id>nexus</id>
<name>Nexus private</name>
<mirrorOf>*</mirrorOf>
<url>http://192.168.198.128:8081/repository/maven-public/</url>
</mirror>
3、解決方案:在 settings.xml 的 servers 標簽中添加如下配置
<server>
<id>nexus</id>
<username>admin</privateKey>
<password>admin123</passphrase>
</server>
注意:mirror 標簽內的 id 和 servier 標簽內的 id 對應的值保持一致