Ant build failed unable to delete file




















This seems to be a problem with the ant plugin. In my case, when the plugin parses the build. As soon as an action causes the ant plugin to parse the build. I consider this a bug in the ant plugin -- it should only hold open file handles while the target is being run.

I have found no work-around for this problem other than reverting to command line usage of ant instead of the eclipse plugin. The entire build could be restructured to put duplicate copies of these jars elsewhere and update the taskdef targets, but that's a serious hack. People on the team with mac or linux don't see this because those allow you to delete a file that has an open file handle.

Can debate the merits of that elsewhere. I had that problem too. It was caused because of a denied permission for a folder. I couldn't switch owner of the folder. What solved the problem was to install Lockhunter unlock the folder, deleting and recreating it.

Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 8 years, 7 months ago. Active 3 months ago. Viewed 15k times. Eclipse won't delete files but it doesn't answer the question for me about how to get eclipse to run ant without having to restart every time. ENTRY org.

Community Bot 1 1 1 silver badge. If any file is open within the directory windows will refuse to delete. OS level error. It's not an error. Eclipse-ant locks the file and will not release the lock unless restart of eclipse.

I think it's a bug or "error" in eclipse ant plug-in, and it seems to be associated with the ivy dependency manager, because I've never seen this prior to ivy integration. More likely to be an OS issue, certainly that has been my experience.

Any chance you're using locking strategy in your ivy settings file? Rarely needed and unlikely to be root case: ant. In my experience of Kepler, it locks jars that are mentioned on the classpath of projects. You don't need to actually run any process for the lock to materialize. I often have to stop Eclipse and run the ant task at the command window.

I don't know if it would be easy to kill the handles to the problem jar files using SysInternals handle. No, this happens also when no IDE or Tomcat is running. So there must be some other process using the file. How can I find out which? Is it correct that WinXP just ignores this attribute?

And is there a way to remove it, I've tried right-clicking the file and accessing the File properties dialog. Roseanne Zhang. Bear Bibeault is correct, I think. Windose makes a lot of decisions for you, even it is not always correct. I was struggling with similar problems these two days. When ant cannot do it, then try use your hand to delete it, if you cannot, it is clear it is "Windose". How to fight with your "Windose"? I am able to delete the file manually, so the problem must in some way be related to Ant.

Having to delete the file manually every time you deploy becomes extremely tedious after a while. Joe Chitrady. I too was struggling for a long time and finally this is the solution for me which I think is applicable to some of us. This is not related to windows have a lock on the file as the file can be renamed, deleted manually.

I believe it is a bug in Ant itself. See example below as illustration. If in your target tag your have a depends attribute to a target that refer to the jar file you want to update then you will have this issue. The solution is to remove it from the depends attribute, this would mean that you have to execute all the dependent targets manually first and then the target to build that jar file.

Till Ant is fixed, I think this is the best workaround. Hope this helps. Good luck. Guy Allard. Your first suspect for what has the file locked should be your Antivirus package. Jerome Garcia. Find centralized, trusted content and collaborate around the technologies you use most. Connect and share knowledge within a single location that is structured and easy to search.

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 generated the delete task reports that is was unable to delete some files. When I try to delete them manually it works just fine. The files are apparently not open by any other process but ant still does not manage to delete them. What can I do? I encountered this problem once. It was because the file i tried to delete was a part of a classpath for another task.

You don't say if your build is run as the currently logged on user. If not, the fact that explorer. But deleting it in that same explorer. Is there something from the Ant process that is holding the files or directory open? This would cause the situation where you could delete them after running ant, but not during. I faced the same problem. I didn't have any classpath set to or antivirus running on my machine.

I installed a 32 bit JDK and the issue was resolved. Ant versions before 1. Try using Ant 1. 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've been having this problem a lot lately and it's random. One time it works, the next time it doesn't work. I'm using NetBeans in case that matters and I've added a lot of extra tasks to build. I was having this problem in the -post-jar task.

It would happen when I call unjar on the file, then delete. I suspect that NB is trying to scan the jar and this causes the lock on it.

What worked for me is to immediately rename the jar at the start of -post-jar and add a. Then I call unjar on the temp file. When I'm done I rename back to the desired jar name. I too had the same problem and was tried of manually deleting the build directories. Finally I solved it by renaming the.



0コメント

  • 1000 / 1000