标签:cloud exec content lease XML pre repos cts nap
然后使用 mvn clean package deploy 命令推送到私服时遇到了 Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project fhcloud-m-oa: Failed to deploy artifacts: Could not transfer artifact org.fh:fhcloud-m-oa:jar:0.0.1-20200427.022345-1 from/to maven-snapshots (http://192.168.10.253:9002/nexus/content/repositories/snapshots): Transfer failed for http://192.168.10.253:9002/nexus/content/repositories/snapshots/org/fh/fhcloud-m-oa/0.0.1-SNAPSHOT/fhcloud-m-oa-0.0.1-20200427.022345-1.jar 401 Unauthorized -> 这个问题。
对这个问题的解决方法 在maven 插件中的 setting.xml 需要配置服务的授权信息
<server> <id>releases</id> <username>admin</username> <password>admin123</password> </server> <server> <id>snapshots</id> <username>admin</username> <password>admin123</password> </server> </servers>
然后再项目的Pom文件需要配置自己的私服仓库地址
<!-- 远程nexus仓库 --> <distributionManagement> <repository> <id>release</id> <name>Nexus Release Repository</name> <url>http://192.168.10.253:9002/nexus/content/repositories/releases</url> </repository> <snapshotRepository> <id>snapshots</id> <name>Nexus Release Repository</name> <url>http://192.168.10.253:9002/nexus/content/repositories/snapshots</url> </snapshotRepository> </distributionManagement>
注意:setting中的 Servers中的ID 要欲 pom文件中的 repository的ID 必须一致
maven 打包 deploy 项目时 出现 401 Unauthorized
标签:cloud exec content lease XML pre repos cts nap
原文地址:https://www.cnblogs.com/dayao666/p/12785254.html