mvn -deploy 报错 Failed to deploy artifacts: Could not transfer artifact

问题报错:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project apollo: Failed to deploy artifacts: Could not transfer artifact com.ctrip.framework.ap
ollo:apollo:pom:0.8.0 from/to releases (http://192.168.1.43:8081/nexus/content/repositories/releases/): Failed to transfer file: http://192.168.1.43:8081/nexus/content/repositories/releases/com/ctrip/fra
mework/apollo/apollo/0.8.0/apollo-0.8.0.pom. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
==== building client finished ====

问题分析:
很明显用户权限不足,按网上提供的解决办法:
http://www.iteye.com/problems/71458
mvn -deploy 报错 Failed to deploy artifacts: Could not transfer artifact_第1张图片
修改nexus 的releases 下的Deployment Policy为allow redeploy 和用户deployment 的密码。
然而并没有什么用,还是报401.
mvn -X 这个命令查看当前生效的settings.xml是哪一个。

[DEBUG] Reading global settings from d:\apache-maven-3.3.9-bin\apache-maven-3.3.9\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\Administrator\.m2\settings.xml

发现有2个settings.xml在在git bash里面其使用的是C盘用户目录下的,而C盘这里面的username首字母大写,导致无法连接,所以把安装目录下改好的配置文件复制到
C:\Users\Administrator.m2\下,问题解决。
参考
参考

你可能感兴趣的:(问题中心)