解决: Failed to execute ... maven-deploy-plugin... Return code is: 401, ReasonPhrase: Unauthorized.

前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到教程。

1. 执行  mvn  clean deploy , 想把本地代码 打包并推送到私服 ,报错:

[ERROR] Failed to execute goal org.apache.maven.plugins:
maven-deploy-plugin:2.8.2:deploy (default-deploy) on project client-one:
 Failed to deploy artifacts: Could not transfer artifact com.client:
client-one:jar:0.0.1
-20190717.055439-1 from/to maven-snapshots 
(http://ergouzi.fun:8081/repository/maven-snapshots/):
 Failed to transfer file: 
xxx/repository/maven-snapshots/com/client/client-one/0.0.1-SNAPSHOT/xxx.jar. 
Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]

2. 原因:

setting.xml 中配置的 id  一定要和 pom.xml 中 配置的 id  一致。

setting.xml 中配置的 id 如下:

解决: Failed to execute ... maven-deploy-plugin... Return code is: 401, ReasonPhrase: Unauthorized._第1张图片

pom.xml 中 配置的 id 如下:

解决: Failed to execute ... maven-deploy-plugin... Return code is: 401, ReasonPhrase: Unauthorized._第2张图片

在 pom.xml 中有以上配置后,可不用再加此配置:

解决: Failed to execute ... maven-deploy-plugin... Return code is: 401, ReasonPhrase: Unauthorized._第3张图片

只要 id 对应上了,账号密码无误,就可以 deploy 成功了。

PS:  我还有个小原因,前面一直找错了 setting.xml 文件。我电脑中有多份,因为熟悉位置,就一直以为就是 A 位置的,最后才发现是用的 B 位置的。

 

你可能感兴趣的:(坑,傻踩傻乐,...,Failed,to,execute,goal,goal,Return,code,is:,401,ReasonPhrase:,Unauthorized.)