This simple tip shows you how to stop and start the Tomcat server directly from an Ant script on the Windows system. Here are the two targets to do so:
<!-- start Tomcat target -->
<target name="startTomcat">
<exec executable="bash" os="Windows">
<arg value="../../bin/startup.bat"/>
</exec>
</target>
<!-- stop Tomcat target -->
<target>
<exec executable="bash" os="Windows">
<arg value="../../bin/shutdown.bat"/>
</exec>
</target>
Now, you can call the targets:
<antcall target="startTomcat" />
<antcall target="stopTomcat" />