# Ant Undeploy Problem

Unnsse Khan
Ranch Hand
Posts: 511
Hello again,

I am using JDK 1.5, Eclipse 3.2 (bundled with Ant 1.6.5), and Tomcat 5.5.9 on WinXP.

I created the following Ant build script:

build.properties:

In my project directory, I have a sub-directory named "lib" which contains the particular jar files that I need for my web app. As you can see from looking at my build script, that this lib (after being unextracted from my war file) becomes placed underneath my WEB-INF directory after deployment (which its supposed to do).

Now, my problem is this:

1. When I run the undeploy Ant target from Eclipse's Ant View, I receive this error message:

At first, I thought that this was an Eclipse issue because when I tried to delete the NumberGuess directory under TOMCAT_HOME/webapps manually using Windows Explorer, it stated that another program or person was using this file/folder and that it was unable to do so. When I closed Eclipse and re-tried to manually delete the TOMCAT_HOME/webapps/numberguess folder from Windows Explorer, I was successful.

This led me to believe that it was just an Eclipse issue, but evidently, one can see the same thing happened when I didn't have Eclipse running and ran it from the command line (MS-DOS).

After some more investigation, I discovered that the problem was that I was running Tomcat when I tried to undeploy this application. When I shutdown Tomcat and tried to deploy/undeploy from Eclipse and the command line, it worked!

When I put this app onto a live tomcat server (which can not afford to be shutdown), my solution (which is manually shutdowning the Tomcat and then running my Ant undeploy target) will not be feasible.

Some questions:

(1) Is there a better way to structure an undeploy Ant target?

(2) Should I be using these built-in Ant deploy and undeploy tasks, instead: