【发布时间】:2021-09-28 12:17:20
【问题描述】:
我在 Jenkins 中遇到以下错误(我正在使用货物插件和 tomcat 进行集成测试)。
[2021-07-20T09:46:47.790Z] [错误] 无法在项目 demo-prj- 上执行目标 org.codehaus.cargo:cargo-maven2-plugin:1.7.9:start (start-server) rest-test: 目标 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: Connection timed out (Connection timed out) -> [帮助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 构建中面临上述问题。
【问题讨论】:
-
如消息所述:这是连接超时。你多久再试一次?
-
Jenkins 是在同一台本地机器上运行,还是在 fw 或类似的机器上运行?
-
问题已解决,您可以在下面找到原因和解决方法。谢谢:)
标签: maven jenkins tomcat cargo-maven2-plugin