【发布时间】:2020-01-15 15:18:21
【问题描述】:
我正在尝试构建一个 Jenkins 作业来关闭 tomcat、更新战争并再次重新启动 tomcat。我正在与 maven 合作以获得新的战争。当我直接从服务器执行maven时,maven进程结束,tomcat进程还活着。 但是由于某种原因,每当我尝试从 Jenkins 执行 maven 时,tomcat 进程都会与 Jenkins 一起死亡。
我尝试使用其他工具完成此任务,但结果相同。
下面是我目前的专家;很想获得一些帮助,或者获得有关如何实施的其他建议。
<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>
【问题讨论】: