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 对应的值保持一致