gpt4 book ai didi

java - Artifactory 的 Maven Auth 错误

转载 作者:行者123 更新时间:2023-12-01 09:18:38 24 4
gpt4 key购买 nike

我正在尝试在本地计算机中安装artifactory来管理我的所有项目jar。我已经设置了artifactory,因此它有两个用户:管理员和用户,不允许匿名登录。这是我的 settings.xml:

<?xml version="1.0" encoding="UTF-8"?>
<settings>
<servers>
<server>
<id>central</id>
<username>user</username>
<password>{encrypted-pssw}</password>
</server>
<server>
<id>snapshot</id>
<username>user</username>
<password>{encrypted-pssw}</password>
</server>
</servers>
<mirrors>
<mirror>
<mirrorOf>*</mirrorOf>
<name>remote-repos</name>
<url>http://localhost:8081/artifactory/remote-repos</url>
<id>remote-repos</id>
</mirror>
</mirrors>
<profiles>
<profile>
<id>central</id>
<repositories>
<repository>
<id>artifactory</id>
<url>http://localhost:8081/artifactory/repo</url>
<layout>default</layout>
<name>Artifactory default repo</name>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>central</activeProfile>
</activeProfiles>

“{encrypted-pssw}”是通过对artifactory 中的加密密码进行加密(mvn -ep)而获得的密码。当我尝试安装(“mvn clean install”)或部署(“mvn deploy”)每个项目时,它都会出现以下错误:

Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to remote-repos (http://localhost:8081/artifactory/remote-repos): Not authorized , ReasonPhrase: Unauthorized. -> [Help 1]

我也尝试过 rsa 身份验证,但没有成功

编辑:更多信息:

如果我尝试使用存储库中的浏览器登录,它会要求输入用户名和密码,如果我输入它们(使用来自 Artifact 的加密密码),它允许我查看存储库。

如果我使用作为网址:http://user:passw@localhost:8081它可以工作并且 Maven 可以登录,但是如果我使用此解决方法,我需要做很多脏工作,在整个项目中复制我的密码(注意:url 中使用的密码是我从加密密码字段中获取的密码) Artifactory,不是我从maven命令中得到的双重加密的)

最佳答案

这可能是由于以下原因造成的:

  1. 您能否检查该用户是否具有对聚合在“remote-repos”虚拟存储库下的远程存储库的部署权限?如果不是,您应该向用户授予构建解析所需的远程存储库的部署权限。如果您不确定,可以尝试使用管理员用户,看看是否有效。

  2. 检查您的 Artifactory UI --> 管理 --> 安全配置 --> “隐藏未经授权资源的存在”是否选中了此复选框?如果是这样,您将需要在 Maven 上定义“抢占式身份验证”(应在您的 settings.xml 文件中定义。请参阅 google 了解如何添加它。

  3. 我想到的最后一件事是,您能否仔细检查 settings.xml 文件中的加密密码是否正确写入?

希望这将帮助您找到问题的根本原因并解决它。

关于java - Artifactory 的 Maven Auth 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40329688/

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