从ant脚本启动tomcat
我正在使用以下 ANT 脚本来运行 tomcat:
<macrodef name="start-tomcat">
<sequential>
<exec executable="/bin/sh" >
<arg value="-c" />
<arg value='${tomcat.bin.dir}/startup.sh -Xms128M -Xmx512M' />
</exec>
</sequential>
</macrodef>
当我从 shell 运行 tomcat 启动脚本时,tomcat 正常启动,并且我看到如下输出:
Using CATALINA_BASE: /u/app
Using CATALINA_HOME: /u/app/3rdparty/apache-tomcat-6.0.33
Using CATALINA_TMPDIR: /u/app/temp
Using JRE_HOME: /usr/java/jre1.6.0_13
Using CLASSPATH: /u/app/3rdparty/apache-tomcat-6.0.33/bin/bootstrap.jar
我有两个问题:
- 如何告诉 ant 显示如上所述的输出? ant 仅在出现错误时显示输出。
- 当我使用 ant 可执行文件从 shell 运行 build.xml 文件时,tomcat 会启动。通过 CI 服务器运行构建文件时 - 特别是 Jenkins (Hudson) tomcat 不会启动。
我发现很难理解如何使用
任务来运行 shell 脚本,我做错了什么吗?
谢谢。
i'm using the following ANT script to run tomcat:
<macrodef name="start-tomcat">
<sequential>
<exec executable="/bin/sh" >
<arg value="-c" />
<arg value='${tomcat.bin.dir}/startup.sh -Xms128M -Xmx512M' />
</exec>
</sequential>
</macrodef>
when i run the tomcat startup script from shell, tomcat starts normally and I see an output like this:
Using CATALINA_BASE: /u/app
Using CATALINA_HOME: /u/app/3rdparty/apache-tomcat-6.0.33
Using CATALINA_TMPDIR: /u/app/temp
Using JRE_HOME: /usr/java/jre1.6.0_13
Using CLASSPATH: /u/app/3rdparty/apache-tomcat-6.0.33/bin/bootstrap.jar
I have two problems:
- How can I tell ant to show me output like the above ? ant only shows me output when there is error.
- When i'm running the build.xml file from shell with ant executable tomcat does start up. when running the build file through a CI server - specifically Jenkins (Hudson) tomcat DOESN'T starts up.
I'm finding it hard to understand how to use the <exec>
task to run shell scripts, is there anything i'm doing wrong ?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
该问题与此处描述的名为
ProcessTreeKiller
的 Jenkins 功能有关。一个>。基本上,Jenkins 通过在进程树中搜索具有特定环境变量的进程来自动终止作业生成的所有进程
。我所要做的就是覆盖名为
BUILD ID
的 jenkins env 变量,它就起作用了。我使用 Setenv 插件 来设置特定于构建的环境变量。
The problem had to do with Jenkins feature called
ProcessTreeKiller
described here.Basically Jenkins automatically kills all processes spawned by a job by searching the process tree for processes with specific environment variable
All i had to do was to overwrite jenkins env variable called
BUILD ID
and it worked.I used a Setenv Plugin to set the env var specific for the build.
执行这样的命令怎么样:
What about executing the command like this :
build.properties 文件:
loadproperties 文件
build.properties file:
loadproperties file