I'm trying to build a Jenkins job to shutdown tomcat, update war and restart tomcat again. I'm working with maven to get the new war. When I execute maven directly from the server, the maven process finishes and the tomcat process is still alive. But for some reason, whenever I try to execute maven from Jenkins the tomcat process dies together with the Jenkins.
I tried accomplishing this task with a different tool, but it resulted in the same behavior.
Below is my current maven; would love to get some help around it, or get another suggestion on how to implement.
<plugin>
<groupId>org.jvnet.maven-antrun-extended-plugin</groupId>
<artifactId>maven-antrun-extended-plugin</artifactId>
<version>1.8</version>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-optional</artifactId>
<version>1.5.3-1</version>
</dependency>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>20020829</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>promote-from-existing-env-ant</id>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<property environment="env"/>
<exec
dir="${tomcat-path}bin"
executable="${tomcat-path}bin/shutdown.sh"
failonerror="false">
<env key="PATH" path="${env.PATH}:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin"/>
</exec>
<delete includeEmptyDirs="true" dir="${tomcat-path}webapps/${war.name}" />
<delete includeEmptyDirs="true" file="${tomcat-path}webapps/${war.name}.war" />
<copy todir="${tomcat-path}webapps" overwrite="true" verbose="true">
<fileset dir="${project.build.directory}/war/"></fileset>
</copy>
<exec
dir="${tomcat-path}bin"
executable="${tomcat-path}bin/startup.sh"
failonerror="false" >
<env key="PATH" path="${env.PATH}:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin"/>
<env key="ANTRUN_NOHUP" value="true" />
</exec>
</tasks>
</configuration>
</execution>
</executions>
</plugin>