0755mx 发表于 2017-1-16 11:09:35

ant 启动与关闭tomcat

启动
  注意tomcat.home是你的tomcat的安装路径
Java代码  


[*]<target name="start-tomcat" description="tomcat starting.....">   
[*]        <exec executable="${tomcat.home}/bin/startup.bat" spawn="true" vmlauncher="false">   
[*]        <env key="CATALINA_HOME" value="${tomcat.home}" />   
[*]        <arg line="/c start ${tomcat.home}/bin/startup.bat" />   
[*]      </exec>        
[*]   </target>  

  关闭
Java代码  


[*]<target name="tomcat.stop">   
[*]    <java jar="${tomcat.home}/bin/bootstrap.jar" fork="true">   
[*]        <jvmarg value="-Dcatalina.home=${tomcat.home}"/>   
[*]        <arg line="stop"/>   
[*]    </java>   
[*]    <waitfor maxwait="5" maxwaitunit="second">   
[*]                                <available file="errors.log"/>   
[*]    </waitfor>   
[*]  
[*]</target> 
页: [1]
查看完整版本: ant 启动与关闭tomcat