ant启动和关闭tomcat

1.ant 直接启动tomcat,build.xml配置

1.1启动tomcat

注意tomcat.home是你的tomcat的安装路径

		<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>
 

 1.2关闭tomcat

		<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>
 

你可能感兴趣的:(java,tomcat,c,xml,ant)