I have an ant build that makes directories, calls javac and all the regular stuff. The issue I am having is that when I try to do a clean (delete all the stuff that was generate
Using Ant Retry task has helped me. I've just wrapped it around the Delete Task.
In my case, I stopped running Java process from Task Manager and re-run the Ant build file. The file was able to delete and build was successful.
In my case my ant clean was failing from Eclipse, unable to remove build files. I see this from time to time. Usually succeeds on a repeat attempt. This time no. Tried running ant clean from command line, failed Unable to delete"unable to delete". It must have been Eclipse holding on to the problem file, when I exited Eclipse, cmd line was able to delete OK.
I am seeing problems like this way too often since I switched to Microsoft Windows 10. Renaming the file immediately before removing it solved it for me:
<rename src="file.name" dest="file.name.old"/>
<delete file="file.name.old" />
Ant versions before 1.8.0 have a bug which leads to random errors during delete operation. Try using Ant 1.8.0 or newer.
You can see the bug details here https://issues.apache.org/bugzilla/show_bug.cgi?id=45960
I encountered this problem once. It was because the file i tried to delete was a part of a classpath for another task.