【发布时间】:2015-11-29 18:05:24
【问题描述】:
项目的 Maven 构建在一个系统上失败,但在其他系统上失败。
其他系统正确确定父 pom 位于此处:
http://(address)/nexus/service/local/repositories/releases/content/(path/to/parent.pom)
失败的构建会查看每个代理存储库地址,但未能在正确的代理地址或任何其他代理服务器上找到它(请参阅下面的错误输出)。
两个系统都使用相同的 JDK 和 Maven 版本,并使用相同的 settings.xml 文件来标识相应的代理存储库。它们与网络具有相同的物理连接,以及类似的防火墙等设置。没有第三方防病毒软件。主要区别在于故障系统运行的是 Windows Server 2012,而不是 Windows 7 或 8。
什么可能导致这个单一构建失败?
如何确定为什么无法从正确的 URL 下载 POM? (请注意,该 URL 可从 Internet 浏览器访问;可以轻松手动下载 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 请求的标头:
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',
}
【问题讨论】:
-
我没有看到这个问题,但工作版本使用相同的(我相信非 NTLM)代理。从 3.3.3 恢复到 3.0.3 并没有解决问题,也没有包括在该解决方法评论中链接的轻量级旅行车 jar。不过还是谢谢。
-
2012盒子可以直接通过浏览器进入仓库吗?
-
@TheFiddlerWins 我可以,实际上问题现在已经解决了。请参阅我在下面留下的答案。谢谢。
标签: maven proxy windows-server-2012