joost
joost

Reputation: 71

Why does Eclipse keep (a) jar(s) in the target folder open?

I'm working on a project and I try to run (outside of Eclipse, in cygwin (thus Windows environment)):

mvn clean

which fails because of:

org.apache.maven.plugins:maven-clean-plugin:2.4:clean (default-clean) on project *****: Failed to clean project: Failed to delete path_to_project\target\org.apache- commons-httpclient-3.1.jar -> [Help 1]

I know it's eclipse keeping the jar opened. When I clean my projects in Eclipse before I run the maven command, the error doesn't occur (obviously Eclipse cleans the target folders).

Upvotes: 0

Views: 162

Answers (1)

Aaron Digulla
Aaron Digulla

Reputation: 328760

This happens, for example, when you run Maven on Windows outside of Eclipse and Eclipse is configured to refresh the workspace automatically.

What happens is that Maven starts to change files in the workspace and Eclipse notices and tried to see what is happening. If the two accidentally happen to try to access the same file, one of them loses. Usually, it's Maven (because Eclipse just logs an error and continues).

You can disable the automatic refresh while Maven runs or switch to "Refresh on Access" if you have Eclipse 3.7.

Upvotes: 2

Related Questions