Maven Sonatype Nexus出于某种未知的原因给出了401
我们必须使用Nexus OSS版本3.20.1-01。当我们试图将Maven2工件(jar)部署或推送到Nexus时,我们遇到了一个问题。我们使用了密码为test123的帐户test123。test123在nexus中具有privildges nx admin。如果我们尝试登录到管理控制台,我们可以做到这一点没有任何问题 但如果我们试图引用Nexus上配置的名为sligro proxy的代理服务器,那么出于某种原因,它会发送401 我们使用Maven 3.5.4 但是出于一些愚蠢的原因,我们不能使用代理sligro代理来访问maven central。如果我们通过删除settings.xml文件来使用没有Nexus的Maven,那么这个构建就可以了/mvn包 如果我在settings.xml文件中更改了某些内容,那么我会看到构建对该更改做出响应 我们在Nexus的request.log中看到401,如下所示:Maven Sonatype Nexus出于某种未知的原因给出了401,maven,nexus3,Maven,Nexus3,我们必须使用Nexus OSS版本3.20.1-01。当我们试图将Maven2工件(jar)部署或推送到Nexus时,我们遇到了一个问题。我们使用了密码为test123的帐户test123。test123在nexus中具有privildges nx admin。如果我们尝试登录到管理控制台,我们可以做到这一点没有任何问题 但如果我们试图引用Nexus上配置的名为sligro proxy的代理服务器,那么出于某种原因,它会发送401 我们使用Maven 3.5.4 但是出于一些愚蠢的原因,我们不能
192.168.178.123 - - [16/Feb/2020:19:46:50 +0100] "HEAD /nexus/repository/sligro-proxy/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom HTTP/1.1" 401 - 0 2 "Apache-Maven/3.5.4 (Java 1.8.0_112; Linux 3.10.0-957.27.2.el7.x86_64)" [qtp1998317514-191]
在客户机上,我们看到:
[信息]完成时间:2020-02-16T19:46:50+01:00
[信息]------------------------------------------------------------------------
[错误]Plugin org.apache.maven.plugins:maven resources Plugin:2.6或其一个依赖项无法解析:未能读取org.apache.maven.plugins:maven resources Plugin:jar:2.6:无法将工件org.apache.maven.plugins:maven resources Plugin:pom:2.6从/到nexus():未授权,理由短语:未经授权。->[帮助1]
[错误]
[错误]要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。
[错误]使用-X开关重新运行Maven以启用完整调试日志记录。
[错误]
[错误]有关错误和可能的解决方案的更多信息,请阅读以下文章:
[错误][帮助1]
这是my settings.xml文件:
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>nexus-proxy</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>sligro</id>
<name>maven-releases</name>
<url>http://192.168.178.178:8081/nexus/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>sligro</id>
<name>maven-snapshots</name>
<url>http://192.168.178.178:8081/nexus/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>```
This is my settings.xml file:
</project>This is my settings file:<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<proxies/>
<servers>
<server>
<id>nexus-snapshots</id>
<username>test123</username>
<password>test123</password>
</server>
<server>
<id>nexus-releases</id>
<username>test123</username>
<password>test123</password>
</server>
<server>
<id>sligro</id>
<username>test123</username>
<password>test123</password>
</server>
<server>
<id>sligro-proxy</id>
<username>test123</username>
<password>test123</password>
</server>
<server>
<id>/192.168.178.178:8081</id>
<username>test123</username>
<password>test123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://192.168.178.178:8081/nexus/repository/sligro-proxy</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>sligro</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<properties>
<nexus.url>http://192.168.178.178:8081/nexus/repository</nexus.url>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>sligro</activeProfile>
</activeProfiles>
</settings>
Well I almost spend to 2 days this weekend to find out what the problem is and
changed tons of params but it gives always the 401. Help would be appriciated.
Thanks
4.0.0
com.example
nexus代理
1.0-快照
朱尼特
朱尼特
4.10
斯莱格罗
maven发布
http://192.168.178.178:8081/nexus/repository/maven-释放/
斯莱格罗
maven快照
http://192.168.178.178:8081/nexus/repository/maven-快照/
```
这是my settings.xml文件:
这是我的设置文件:
nexus快照
测试123
测试123
nexus发布
测试123
测试123
斯莱格罗
测试123
测试123
sligro代理
测试123
测试123
/192.168.178.178:8081
测试123
测试123
关系
*
http://192.168.178.178:8081/nexus/repository/sligro-代理
斯莱格罗
中心的
http://central
真的
真的
中心的
http://central
真的
真的
http://192.168.178.178:8081/nexus/repository
斯莱格罗
这个周末我几乎花了2天的时间来找出问题所在,然后
改变了很多参数,但它总是给出401。我们将感谢您的帮助。
谢谢
我找到了解决办法。我的镜像有错误的ID。如果我在镜像部分使用“sligro”ID而不是“nexus”ID,那么Maven构建到nexus运行正常