I am facing below error in Jenkins (I am using cargo plugin with tomcat for integration tests).
[2021-07-20T09:46:47.790Z] [ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.7.9:start (start-server) on project demo-prj-rest-test: Execution start-server of goal org.codehaus.cargo:cargo-maven2-plugin:1.7.9:start failed: Failed to download [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) -> [Help 1]
Below is my cargo plugin:
<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>
This works perfectly in local maven build with all integration tests run successfully in the cargo tomcat but facing above mentioned issue in Jenkins build.