maven deploy到nexus报错:Return code is: 401, ReasonPhrase:Unauthorized

…衆ロ難τιáo~ 提交于 2020-01-19 16:42:29

今天想把一个写好的工具jar 打包到 nexus 上去 但是第一用 不是很熟悉 检出 出现错误 

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project sms: Failed to deploy artifacts: Could not transfer artifact com.wjl:sms:jar:1.0.0 from/to releases (http://192.168.3.7:8081/nexus/content/repositories/thirdparty/): Failed to transfer file: http://192.168.3.7:8081/nexus/content/repositories/thirdparty/com/wjl/sms/1.0.0/sms-1.0.0.jar. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]

错误原因:未添加到检出私服的的认证 

idea 中 File - - > settings  ---> maven  

到该目录下进行修改文件 在servers 标签下添加如下

pom文件中的 配置

注意 pom文件的id 要和在 maven中配置的server的id 一致 否则不起作用 

请看maven 中对 servers的描述 简单说 servers 就是认证的配置文件通过 server id 进行在系统中使用 所以server id  pom 文件中的 要和maven 中settings中 servers 的中 配置server id 一直 

配置修改 后

deploy 成功 


————————————————
版权声明:本文为CSDN博主「寂夜了无痕」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/a15835774652/article/details/80354602

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!