Stop Tomcat cleanly using Ant
Posted on 2003-12-05
As part of my ANT build script I need to shut down tomcat, clean some stuff up then do a clean deployment. I stop tomcat with the following target.
<!-- Stop Tomcat -->
<java classname="org.apache.catalina.startup.Bootstrap" fork="yes">
<jvmarg value="-Dcatalina.home=c:\tomcat" />
<arg value="stop" />
<include name="bin/bootstrap.jar" />
This stops the server but leaves the window open. The final line in the window says
[java] Stopping service Tomcat-Standalone. If I navigate to the server it seems to be shut down.
Problem is that when my script goes to clear out the shared/lib folder on tomcat I get the following error:
file:C:/cruisecontrol/work/build.xml:169: Unable to delete file T:\shared\lib\ac
(I don't think the problem has anything to do with activatipon.jar specifically its just the first alphabetically)
If I close the tomcat window manually the problem goes away. Any idea on how I can shut down cleanly using ANT.
Thanks in advance.