Tomcat 詹金斯没有通过maven antrun运行Catalina.bat
我试图在詹金斯的一份工作中使用maven antrun插件来启动Tomcat。我知道我可以用同样的货物,但我不能用它。原因是我希望Tomcat在构建完成后运行应用程序 下面是一个场景——我有一个作业1,它检查一个项目->构建它->在Tomcat上部署它。 另一个作业是,作业2签出另一个项目->在ESB上构建并部署它,然后使用作业1上部署的Tomcat运行集成测试。 我需要在作业1中停止Tomcat一次,这是我使用cargo实现的:在清理阶段停止—然后我计划在编译阶段之后使用maven antrun启动它。然后在包装阶段之后再次使用货物重新部署新的战争。我需要这样做,以便每次测试构建都能刷新Tomcat,而不会出现Permgen等问题 无论如何,问题是我的以下脚本在命令提示符下运行良好,即它启动Tomcat fine并为Startup.bat打开一个命令窗口。但是,当我在詹金斯尝试同样的方法时,它并没有被执行,有趣的是它并没有抱怨——简单不会启动tomcatTomcat 詹金斯没有通过maven antrun运行Catalina.bat,tomcat,maven,jenkins,hudson,maven-antrun-plugin,Tomcat,Maven,Jenkins,Hudson,Maven Antrun Plugin,我试图在詹金斯的一份工作中使用maven antrun插件来启动Tomcat。我知道我可以用同样的货物,但我不能用它。原因是我希望Tomcat在构建完成后运行应用程序 下面是一个场景——我有一个作业1,它检查一个项目->构建它->在Tomcat上部署它。 另一个作业是,作业2签出另一个项目->在ESB上构建并部署它,然后使用作业1上部署的Tomcat运行集成测试。 我需要在作业1中停止Tomcat一次,这是我使用cargo实现的:在清理阶段停止—然后我计划在编译阶段之后使用maven antru
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>startTomcat</id>
<phase>compile</phase>
<configuration>
<target>
<exec executable="C:\Windows\System32\cmd.exe" spawn="true">
<arg value="/c" />
<arg value="D:\apache-tomcat-6.0.36\bin\startup.bat" />
</exec>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
我尝试了executable=“C:\Windows\System32\cmd.exe”和executable=“cmd.exe”-同样的问题,即当从命令提示符运行时,它工作正常,但在jenkins中,这不会启动tomcat,也不会出错
已检查Jenkins-系统配置和用户名。用户名为NEW-LT7-0064$。
不确定这是否有任何帮助,但当我从命令提示符运行时,用户是我的windows登录用户。
我还使用本地系统帐户运行Jenkins作为Windows服务
我尝试了以下内容,也尝试了链接中的建议,但在Windows 64位Windows 7机器上也不起作用
Another workaraund for Windows XP and later is to shedule permanent task and force running it from the ant script.
Once run the command:
C:\>SCHTASKS /Create /RU SYSTEM /SC ONSTART /TN Tomcat /TR "C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin\startup.bat"
Note, that ONSTART can be replaced with ONCE if you do not want to keep Tomcat running.
Add the following code to your ant script:
<exec executable="SCHTASKS">
<arg value="/Run"/>
<arg value="/TN"/>
<arg value="Tomcat"/>
</exec>
Windows XP及更高版本的另一项工作是安排永久任务并强制从ant脚本运行它。
运行命令后:
C:\>SCHTASKS/Create/RU SYSTEM/SC-ONSTART/TN-Tomcat/TR“C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin\startup.bat”
注意,如果您不想让Tomcat继续运行,ONSTART可以替换为ONCE。
将以下代码添加到ant脚本:
您确定tomcat根本没有启动吗?IIRC Jenkins不支持生成长期存在的构建过程(请参阅)
关于tomcat,可能会有帮助:将tomcat作为服务启动,而不是使用shell脚本。Hi Tang。是的,我检查过tomcat没有启动。我已经检查了Tomcat的启动日志,但没有发生任何事情。好的,我将探索是否可以将tomcat作为一项服务进行控制——但是上面的问题仍然存在。为什么Jenkins不能将bat文件作为maven构建的一部分执行,而maven构建在命令提示符maven build中运行良好。我怀疑这与用户名的权限/路径有关。有什么想法吗?仅供参考。。我尝试了这里的选项(从你上面发布的链接中找到)。似乎对某些人有效,但对我无效:-(
Another workaraund for Windows XP and later is to shedule permanent task and force running it from the ant script.
Once run the command:
C:\>SCHTASKS /Create /RU SYSTEM /SC ONSTART /TN Tomcat /TR "C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin\startup.bat"
Note, that ONSTART can be replaced with ONCE if you do not want to keep Tomcat running.
Add the following code to your ant script:
<exec executable="SCHTASKS">
<arg value="/Run"/>
<arg value="/TN"/>
<arg value="Tomcat"/>
</exec>