我正在尝试从jenkins管道构建一个spring-boot maven项目。
误差
ERROR: Failed to parse POMs
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for xxx.xxxxx.xxxx:finance-portal:0.0.1-SNAPSHOT:
Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.4.2
Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.4.2
from/to central (https://repo.maven.apache.org/maven2):
Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.24.215] failed:
Connection refused (Connection refused) and 'parent.relativePath' points at no local POM @ line 6, column 10maven目标
clean install -U -Xpom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.2</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>到目前为止我尝试过的决心
settings.xml文件建立组织代理,并在管道中使用配置.通过maven目标设置代理的clean install -DproxySet=true -DproxyHost=proxy.com -DproxyPort=xxxxx.:
relativePath标记在pom.xml to <relativePath>../pom.xml</relativePath>和其他几个变体中。curl请求,以检查连接建立:curl -I -x proxy.com:xxxxx "https://repo.maven.apache.org/maven2"。连接被建立,但在构建过程中失败.发布于 2021-09-30 07:28:06
虽然30thh的回答对故障排除绝对有帮助,但作为最后的手段,我刚刚将一个工作的VM克隆到一个新实例中,在那里创建了我的管道,在第一次尝试中它就像一种魅力一样工作。所以很明显,这与以前的VM/jenkins的proxy/firewall有关。
发布于 2021-09-25 10:26:14
我打赌您错过了配置代理设置的东西。例如,设置错误的协议,或者将proxies标记拼错/放置在setting.xml文件中。
下面是Apache手册中的一个示例:
<settings>
.
<proxies>
<proxy>
<id>example-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
</proxy>
</proxies>
.
</settings>该协议似乎是代理服务器的协议,而不是代理请求的协议。以下是关于这一点的长时间讨论:
How to configure a proxy server for both HTTP and HTTPS in Maven's settings.xml?
您的setting.xml也有可能放置在错误的位置。以下是默认位置:
(Linux) /home/bob/.m2/settings.xml
(Windows) C:\Users\bob\.m2\settings.xmlIDE或CD/CI管道可以覆盖默认位置。可以这样做:
mvn --settings your_location/settings.xml clean install
(or)
mvn -s your_location/settings.xml clean install另一个问题可能是与JVM代理配置的冲突。我不确定哪种配置有优先权。JVM使用自己的参数:
http.proxyHost (default: <none>)
http.nonProxyHosts (default: localhost|127.*|[::1])
http.proxyPort (default: 80)
https.proxyHost(default: <none>)
https.proxyPort (default: 443)这里,http和https是代理请求的协议(至少是AFAIU)。
https://docs.oracle.com/javase/8/docs/api/java/net/doc-files/net-properties.html
另一个可能的问题可能是论点-Djava.net.useSystemProxies。如果将其设置为true (默认- false),则使用操作系统范围的代理配置。
https://stackoverflow.com/questions/69255452
复制相似问题