<!-- Launches Tomcat --> <target name="tomcat-start" description="Launches Tomcat"> <fail unless="env.TOMCAT_HOME" message="You must set the TOMCAT_HOME environment variable to point to your Tomcat installation folder"/> <exec dir="${env.TOMCAT_HOME}/bin" executable="catalina.bat" vmlauncher="false" spawn="true"> <arg value="start"/> </exec> </target> <!-- Launches Tomcat in debug mode --> <target name="tomcat-start-debug" description="Launches Tomcat in JDPA debug mode on port 8000"> <fail unless="env.TOMCAT_HOME" message="You must set the TOMCAT_HOME environment variable to point to your Tomcat installation folder"/> <exec dir="${env.TOMCAT_HOME}/bin" executable="catalina.bat" vmlauncher="false" spawn="true"> <arg value="jpda"/> <arg value="start"/> <env key="JPDA_ADDRESS" value="8000"/> <env key="JPDA_TRANSPORT" value="dt_socket"/> </exec> </target> <!-- Shuts down Tomcat --> <target name="tomcat-stop" description="Shuts down Tomcat"> <fail unless="env.TOMCAT_HOME" message="You must set the TOMCAT_HOME environment variable to point to your Tomcat installation folder"/> <exec dir="${env.TOMCAT_HOME}/bin" executable="shutdown.bat" vmlauncher="false" spawn="true"/> <sleep seconds="2"/> </target>
dt_socket:表示使用远程调式(dt_shmem表示本地调式),采用类似注入变量的形式去设置一些启动属性,避免手动修改catalina.bat文件。