• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

deleting directories in ant

 
L Brennan
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2987
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic