java 打包 mvn clean package时 "401 Unauthorized and 'parent.relativePath' points at wrong local POM"
在虚拟机上单独拉取一个项目进行打包时出现如下错误[ERROR] [ERROR] Some problems were encountered while processing the POMs:[FATAL] Non-resolvable parent POM for com.gbx:spring-cloud-demo-config:1.0.0-SNAPSHOT:Could not...
·
在虚拟机上单独拉取一个项目进行打包时出现如下错误
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.gbx:spring-cloud-demo-config:1.0.0-SNAPSHOT:
Could not transfer artifact com.gbx:spring-cloud-demo-dependencies:pom:1.0.0-SNAPSHOT from/to nexus (http://192.168.73.132:8081/repository/maven-public/):
Authentication failed for http://192.168.73.132:8081/repository/maven-public/com/gbx/spring-cloud-demo-dependencies/1.0.0-SNAPSHOT/spring-cloud-demo-dependencies-1.0.0-SNAPSHOT.pom
401 Unauthorized and 'parent.relativePath' points at wrong local POM @ line 6, column 13
原因是因为寻找parent依赖出错,可是我已经把依赖部署到了nexus私服里了,突然想起nexus私服账户没有在虚拟机里设置(
(lll¬ω¬) )!
在maven的settings.xml中<servers>节点下设置你的nexus私服账户
vi /usr/local/maven/apache-maven-3.6.3/conf/settings.xml
此处id要与你pom中引用的id一致,账号密码同步于你自己的nexus私服
<server>
<id>nexus</id>
<username>admin</username>
<password>123456</password>
</server>
<server>
<id>nexus-releases</id>
<username>admin</username>
<password>123456</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>123456</password>
</server>
相应的pom文件中应有此处nexus私服配置
<repositories>
<repository>
<id>nexus</id>
<name>Nexus Repository</name>
<url>http://192.168.73.132:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
更多推荐
已为社区贡献7条内容
所有评论(0)