gpt4 book ai didi

Maven:无法部署 Artifact ,访问被拒绝

转载 作者:行者123 更新时间:2023-12-04 14:57:48 25 4
gpt4 key购买 nike

我有一个 Sonatype Nexus 服务器,我想部署一个快照。

这是我的 settings.xml 文件的片段:

<servers>
<server>
<id>test-snapshots</id>
<username>myname1</username>
<password>mypasswd1</password>
</server>
<server>
<id>test-releases</id>
<username>myname2</username>
<password>mypasswd2</password>
</server>
</servers>

这是我的 pom.xml 文件的片段:
<distributionManagement>
<repository>
<id>test-releases</id>
<name>Releases</name>
<url>https://nxs.company.com/content/repositories/test-releases</url>
</repository>
<snapshotRepository>
<id>test-snapshots</id>
<name>Snapshots</name>
<url>https://nxs.company.com/content/repositories/test-snapshots</url>
</snapshotRepository>
</distributionManagement>

做一个 mvn deploy (Maven 3.0.3) 我收到这个错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy 
(default-deploy) on project MyProject: Failed to deploy artifacts:
Could not transfer artifact com.company.project:MyProject:jar:1.0.0-20121003.154427-1
from/to test-snapshots (https://nxs.company.com/content/repositories/test-snapshots):
Access denied to: https://nxs.company.com/content/repositories/test-snapshots/
com.company.project/MyProject/1.0.0-SNAPSHOT/MyProject-1.0.0-20121003.154427-1.jar
-> [Help 1]

在我的 Nexus 日志文件中,我看到没有收到任何凭据,因此它将稍后以匿名方式尝试,这当然会失败。那么为什么没有凭据传递给 Nexus?
2012-10-03 17:24:14 DEBUG [1027496148-8353] - org.apache.shiro.session.mgt.DefaultSessionManager - Unable to resolve session ID from SessionKey [org.apache.shiro.web.session.mgt.WebSessionKey@791a17dc].  Returning null to indicate a session could not be found.
2012-10-03 17:24:14 DEBUG [1027496148-8353] - org.sonatype.nexus.security.filter.authc.NexusContentAuthenticationFilter - No authorization found (header or request parameter)
2012-10-03 17:24:14 DEBUG [1027496148-8353] - org.sonatype.nexus.security.filter.authc.NexusContentAuthenticationFilter - No authorization found (header or request parameter)
2012-10-03 17:24:14 DEBUG [1027496148-8353] - org.sonatype.nexus.security.filter.authc.NexusContentAuthenticationFilter - Attempting to authenticate Subject as Anonymous request...
2012-10-04 17:24:14 DEBUG [1027496148-8353] - org.sonatype.security.ldap.realms.DefaultLdapContextFactory - Initializing LDAP context using URL [ldap://10.100.100.1:3268/DC=company,DC=com] and username [ldap@company.com] with pooling [enabled]

最佳答案

对于 Nexus 中的每个存储库,您真的有不同的用户名/密码吗?这将导致 maven http wagon 出现问题,因为 jvm 缓存每个主机的凭据,即使 maven 正确提供备用凭据,jvm 也不会使用它们。解决方法是改用 webdav wagon,因为它使用 apache http 客户端而不是 jdk urlclient。

关于Maven:无法部署 Artifact ,访问被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12732990/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com