gpt4 book ai didi

Maven 无法从代理存储库下载 Artifact ?

转载 作者:行者123 更新时间:2023-12-01 09:39:26 25 4
gpt4 key购买 nike

项目的 Maven 构建在一个系统上失败,但在其他系统上失败。

其他系统正确确定父 pom 位于此处:
http://(address)/nexus/service/local/repositories/releases/content/(path/to/parent.pom)

失败的构建会查看每个代理存储库地址,但无法在正确的代理地址或任何其他代理服务器上找到它(请参阅下面的错误输出)。

两个系统都使用相同的 JDK 和 Maven 版本,使用相同的 settings.xml 文件标识适当的代理存储库。它们具有相同的网络物理连接和类似的防火墙等设置。没有第 3 方防病毒软件。关键区别在于发生故障的系统运行的是 Windows Server 2012 而不是 Windows 7 或 8。

什么可能导致这个单一构建失败?

如何确定无法从正确的 URL 下载 POM 的原因? (请注意,可以从 Internet 浏览器访问该 URL;可以轻松地手动下载 POM。)

扩展的 Maven 输出摘录:

INFO] Scanning for projects...
[DEBUG] Using transporter WagonTransporter with priority -1.0 for http://(address)/nexus/content/groups/public
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for http://(address)/nexus/content/groups/public via proxy.company.org:80 with username=, password=***
Downloading: http://(address)/nexus/content/groups/public/org/company/subgroup/subgroup-project/0.2.10/subgroup-project-0.2.10.pom

[DEBUG] Writing tracking file C:\m2repo\org\company\subgroup\subgroup-project\0.2.10\subgroup-project-0.2.10.pom.lastUpdated
[DEBUG] Using transporter WagonTransporter with priority -1.0 for http://(address)/nexus/content/groups/external
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for http://(address)/nexus/content/groups/external via proxy.company.org:80 with username=, password=***
Downloading: http://(address)/nexus/content/groups/external/org/company/subgroup/subgroup-project/0.2.10/subgroup-project-0.2.10.pom

[DEBUG] Writing tracking file C:\m2repo\org\company\subgroup\subgroup-project\0.2.10\subgroup-project-0.2.10.pom.lastUpdated
[DEBUG] Using transporter WagonTransporter with priority -1.0 for http://(address)/nexus/content/groups/company-subgroup
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for http://(address)/nexus/content/groups/company-subgroup via proxy.company.org:80 with username=, password=***
Downloading: http://(address)/nexus/content/groups/company-subgroup/org/company/subgroup/subgroup-project/0.2.10/subgroup-project-0.2.10.pom

[DEBUG] Writing tracking file C:\m2repo\org\company\subgroup\subgroup-project\0.2.10\subgroup-project-0.2.10.pom.lastUpdated
[DEBUG] Using transporter WagonTransporter with priority -1.0 for http://(address)/nexus/content/groups/mirror
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for http://(address)/nexus/content/groups/mirror via proxy.company.org:80 with username=, password=***
Downloading: http://(address)/nexus/content/groups/mirror/org/company/subgroup/subgroup-project/0.2.10/subgroup-project-0.2.10.pom

[DEBUG] Writing tracking file C:\m2repo\org\company\subgroup\subgroup-project\0.2.10\subgroup-project-0.2.10.pom.lastUpdated
[DEBUG] Using transporter WagonTransporter with priority -1.0 for http://(address)/nexus/content/groups/proxied-repositories
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for http://(address)/nexus/content/groups/proxied-repositories via proxy.company.org:80 with username=, password=***
Downloading: http://(address)/nexus/content/groups/proxied-repositories/org/company/subgroup/subgroup-project/0.2.10/subgroup-project-0.2.10.pom

[DEBUG] Writing tracking file C:\m2repo\org\company\subgroup\subgroup-project\0.2.10\subgroup-project-0.2.10.pom.lastUpdated
[DEBUG] Using transporter WagonTransporter with priority -1.0 for http://(address)/nexus/content/repositories/central
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for http://(address)/nexus/content/repositories/central via proxy.company.org:80 with username=, password=***
Downloading: http://(address)/nexus/content/repositories/central/org/company/subgroup/subgroup-project/0.2.10/subgroup-project-0.2.10.pom

[DEBUG] Writing tracking file C:\m2repo\org\company\subgroup\subgroup-project\0.2.10\subgroup-project-0.2.10.pom.lastUpdated
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for org.company.subgroup.project_package:project:0.1: Could not transfer artifact org.company.subgroup:subgroup-project:pom:0.2.10 from/to public (http://(address)/nexus/content/groups/public): Access denied to: http://(address)/nexus/content/groups/public/org/company/subgroup/subgroup-project/0.2.10/subgroup-project-0.2.10.pom , ReasonPhrase:Forbidden. and 'parent.relativePath' points at wrong local POM @ line 15, column 13
@
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for org.company.subgroup.project_package:project:0.1: Could not transfer artifact org.company.subgroup:subgroup-project:pom:0.2.10 from/to public (http://(address)/nexus/content/groups/public): Access denied to: http://(address)/nexus/content/groups/public/org/company/subgroup/subgroup-project/0.2.10/subgroup-project-0.2.10.pom , ReasonPhrase:Forbidden. and 'parent.relativePath' points at wrong local POM @ line 15, column 13

编辑:

使用 Wireshark,Maven 似乎收到了对其 GET 请求的 403 Forbidden 响应。如果 Maven 外部的相同请求工作正常,为什么 Maven 会收到此响应?

我用来验证 GET 请求的 header :

user_agent = 'Apache-Maven/3.0.3 (Java 1.8.0_51; Windows Server 2012 R2 6.3)'
headers = { 'Accept-Encoding' : 'gzip',
'Pragma' : 'no-cache',
'User-Agent' : user_agent,
'Host' : proxy.company.org',
'Accept' : 'text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2',
'Proxy-Connection' : 'keep-alive',
}

最佳答案

找到了答案。

<proxy> settings.xml 中的设置已定义 <nonProxyHosts>localhost|company.org</nonProxyHosts> .

正确的设置是 <nonProxyHosts>localhost|*.company.org</nonProxyHosts> .

由于某些原因,只有 Windows Server 2012 未能将父 POM 的主机视为非代理主机之一。如果有人知道这可能是为什么,我很好奇,但问题已解决。

关于Maven 无法从代理存储库下载 Artifact ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32383513/

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