aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes deleting directories in ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "deleting directories in ant" Watch "deleting directories in ant" New topic
Author

deleting directories in ant

L Brennan
Greenhorn

Joined: Apr 15, 2003
Posts: 23
I have a target in ant that deleted my temporary build directory. However, I was getting an error saying it couldn't delete the jar files contained there. If I let the build file run to its completion and then run 'ant clean' from the command line, then it works no problem. Its like there is still some sort of thread running against the jars the first time the clean target is called. DOes anyone know how to get around this?
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2864
    
  11

I've seen a similar problem a few times, and have just assumed it's a Windows problem. There are times when I can't delete a file or directory through File Explorer either. Sometimes the problem goes away after awhile, and sometimes I have to log out and in again. It hasn't happened to me since I got a new machine, although I'm still using Windows 2000 Pro. Maybe I have a newer service pack?
Here's some things to try:
1) Make sure no process is using the jar. Your app server should be shut down.
2) Make sure no process is using the directory. In particular, don't have any DOS command lines sitting in that directory.
3) Set failonerror to false. At least then the rest of your clean script can run.
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
I've had the same problem deleting files on Windows 2000. It seems like it takes Windows a little longer to realize that no process is using the file than it should. I generally don't run my clean target as part of the build, so I haven't run into problems with Ant as a result.


Matthew Phillips
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: deleting directories in ant