我正在kubernetes集群上的docker中运行maven。在获取依赖项时,它有时会挂起2个小时,在最终成功之前记录了多个connection timeout
错误。
[11:34:31] : [Step 1/2] [INFO] Downloading: http://repo1.maven.org/maven2/com/path/to/internal/artifact-20181129.112650-1.pom
[11:50:15] : [Step 1/2] Nov 29, 2018 11:50:15 AM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
[11:50:15] : [Step 1/2] INFO: I/O exception (java.net.SocketException) caught when processing request to {}->http://repo1.maven.org:80: Connection timed out (Read failed)
[11:50:15] : [Step 1/2] Nov 29, 2018 11:50:15 AM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
[11:50:15] : [Step 1/2] INFO: Retrying request to {}->http://repo1.maven.org:80
[12:05:59] : [Step 1/2] Nov 29, 2018 12:05:59 PM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
[12:05:59] : [Step 1/2] INFO: I/O exception (java.net.SocketException) caught when processing request to {}->http://repo1.maven.org:80: Connection timed out (Read failed)
[12:05:59] : [Step 1/2] Nov 29, 2018 12:05:59 PM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
[12:05:59] : [Step 1/2] INFO: Retrying request to {}->http://repo1.maven.org:80
[12:21:44] : [Step 1/2] Nov 29, 2018 12:21:44 PM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
[12:21:44] : [Step 1/2] INFO: I/O exception (java.net.SocketException) caught when processing request to {}->http://repo1.maven.org:80: Connection timed out (Read failed)
[12:21:44] : [Step 1/2] Nov 29, 2018 12:21:44 PM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
[12:21:44] : [Step 1/2] INFO: Retrying request to {}->http://repo1.maven.org:80
[12:37:28] : [Step 1/2] [INFO] Downloading: http://nexus/nexus/content/repositories/thirdparty/com/path/to/internal/artifact-20181129.112650-1.pom
这仅发生在内部依赖项上,该内部依赖项应立即回退到我们的内部nexus Maven存储库,该存储库也位于kubernetes集群中。
在这种挂起期间的tcpdump仅显示重新传输,而没有来自中央存储库的响应。除此之外,捕获中充满了ARP查询,直到最后,回退发生并查询我们的内部Nexus服务器。
这是我pom.xml的相关部分:
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>thirdparty</id>
<name>internal third party repo</name>
<url>${nexusUrl}/repositories/thirdparty</url>
</repository>
<repository>
<id>releases</id>
<name>internal releases repo</name>
<url>${nexusUrl}/repositories/releases</url>
</repository>
<repository>
<id>snapshots</id>
<name>internal snapshots repo</name>
<url>${nexusUrl}/repositories/snapshots</url>
</repository>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
<id>license4j-runtime-library</id>
<name>License4J Runtime Library Maven Repository</name>
<url>https://www.license4j.com/maven/</url>
<layout>default</layout>
</repository>
这是我的settings.xml:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers>
<server>
<id>releases</id>
<username>XXX</username>
<password>YYY</password>
</server>
<server>
<id>snapshots</id>
<username>XXX</username>
<password>YYY</password>
</server>
</servers>
<mirrors/>
<proxies/>
<profiles/>
<activeProfiles/>
这种情况每隔一段时间发生一次,但我找不到根本原因。我希望有人在某个地方遇到过这个问题。