我在 Jenkins 中面临以下错误(我正在使用带有 tomcat 的货物插件进行集成测试)。
[2021-07-20T09:46:47.790Z] [错误] 无法在项目 demo-prj-rest-test 上执行目标 org.codehaus.cargo:cargo-maven2-plugin:1.7.9:start (start-server) : 目标 org.codehaus.cargo:cargo-maven2-plugin:1.7.9:start failed 的执行 start-server: 下载失败 [https://repo.maven.apache.org/maven2/org/apache/tomcat/ tomcat/8.0.42/tomcat-8.0.42.zip]:java.net.ConnectException:连接超时(连接超时)-> [帮助 1]
下面是我的货物插件:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.7.9</version>
<configuration>
<container>
<timeout>600000</timeout>
<containerId>tomcat8x</containerId>
<type>installed</type>
<zipUrlInstaller>
<url>https://repo.maven.apache.org/maven2/org/apache/tomcat/tomcat/8.0.42/tomcat-8.0.42.zip</url>
<downloadDir>${project.build.directory}/downloads</downloadDir>
<extractDir>${project.build.directory}/extracts</extractDir>
</zipUrlInstaller>
<output>${project.build.directory}/cargo-container.log</output>
<log>${project.build.directory}/cargo.log</log>
</container>
<deployables>
<deployable>
<groupId>com.example</groupId>
<artifactId>demo-prj-war</artifactId>
<type>war</type>
<location>${project.build.directory}/demo-prj-war</location>
<properties>
<context>demo-prj-war</context>
</properties>
</deployable>
</deployables>
<configuration>
<type>standalone</type>
<home>${project.build.directory}/tomcat8x/container</home>
<configfiles>
<configfile>
<file>${project.basedir}/src/test/resources/war-dependencies/context.xml</file>
<todir>conf/</todir>
<tofile>context.xml</tofile>
</configfile>
</configfiles>
<properties>
<cargo.servlet.port>9090</cargo.servlet.port>
<cargo.logging>high</cargo.logging>
</properties>
</configuration>
</configuration>
<executions>
<execution>
<id>start-server</id>
<goals>
<goal>start</goal>
</goals>
<phase>pre-integration-test</phase>
</execution>
<execution>
<id>stop-server</id>
<goals>
<goal>stop</goal>
</goals>
<phase>post-integration-test</phase>
</execution>
</executions>
</plugin>
这在本地 maven 构建中完美运行,所有集成测试在 cargo tomcat 中成功运行,但在 Jenkins 构建中面临上述问题。