素材巴巴 > 程序开发 >

【问题解决】mvn deploy出现401错误

程序开发 2023-09-08 23:45:53

mvn deploy出现401错误

mvn deploy出现401错误

问题

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on p
 roject panda-config: Failed to deploy artifacts: Could not transfer artifact top.alanlee:panda-config:jar:1.0.
 0-20200223.035607-1 from/to nexus-snapshots (http://xxx.xxx.245.65:8081/repository/maven-snapshots/): Failed t
 o transfer file http://xxx.xxx.245.65:8081/repository/maven-snapshots/top/alanlee/panda-config/1.0.0-SNAPSHOT/
 panda-config-1.0.0-20200223.035607-1.jar with status code 401 -> [Help 1]
 

原因

一般报401这个错,是因为没有权限,没权限的话,大部分都是因为密码错了导致,或者这个账号本身就没有传jar的权限,一般是maven目录conf的setting.xml里没有配置认证,查看maven的config路径下的settings.xml,查看是否设置了用户名和密码。

解决

在.m2/settings.xml中的server节点下设置用户名和密码。

nexus-releasesadmin密码
 nexus-snapshotsadmin密码
 
 

在pom.xml文件中添加

nexus-releasesNexus Release Repositoryhttp://ip:8081/repository/maven-releases/nexus-snapshotsNexus Snapshot Repositoryhttp://ip:8081/repository/maven-snapshots/
 
 

重新执行mvn deploy


标签:

上一篇: XML的显示--CSS 下一篇:
素材巴巴 Copyright © 2013-2021 http://www.sucaibaba.com/. Some Rights Reserved. 备案号:备案中。