我在〜/ .m2/settings.xml中有这个:
<servers>
<server>
<username>deployment</username>
<password>xxxxxx</password>
<id>central</id>
</server>
<server>
<username>deployment</username>
<password>xxxxxx</password>
<id>snapshots</id>
</server>
</servers>
Run Code Online (Sandbox Code Playgroud)
这在我的POM中:
<distributionManagement>
<repository>
<id>central</id>
<name>libs-release-local</name>
<url>http://repo.example.com:8081/nexus/content/repositories/libs-release-local</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>libs-local</name>
<url>http://repo.example.com:8081/nexus/content/repositories/libs-local</url>
</snapshotRepository>
</distributionManagement>
Run Code Online (Sandbox Code Playgroud)
我面临的问题是工件没有部署,nexus日志显示用于进行身份验证的用户名是"匿名的".这就是它失败的原因.为什么maven没有选择settings.xml中指定的用户名/密码,我做错了什么?
此外,我尝试使用-X运行maven,DEBUG日志说它正在读取设置的正确文件:
[DEBUG] Reading global settings from /home/praddy/apache-maven-3.0.5/conf/settings.xml
[DEBUG] Reading user settings from /home/praddy/.m2/settings.xml
[DEBUG] Using local repository at /home/praddy/.m2/repository
Run Code Online (Sandbox Code Playgroud)