Reputation: 373
I recently configured Eclipse (ver. 3.6) in order to make it automatically refresh projects in the workspace (Windows > Preferences > General > Workspace > Refresh Automatically).
Since I changed this configuration I have the following problem when I try to run Maven (Maven install from Eclipse) to build a big project:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project ProjectName: Failed to clean project: Failed to delete C:\ProjectName\target -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
The problem occurs randomly (more or less 50% of the times I build a single project), but when I try to build 14 projects all together I always get this error somewhere. I think that the problem is that Maven is trying to delete files that are locked by Eclipse (that is refreshing the project). In fact it doesn't happen when I disable the "Refresh Automatically" option.
Does anybody know a trick to avoid this trouble?
I noticed there is another question "Eclipse automatically refresh resources and exclude build dir" about this topic, but there are no answers. I hope I provided enough information to understand the problem.
Upvotes: 5
Views: 3024
Reputation: 63912
I think it was bug in Eclipse in earlier version, as it should not block any files inside target
folder.
I had this issue before myself, but don't run into in recent years. So if you do, raise bug at https://bugs.eclipse.org/bugs/ against m2e or what may be more suitable.
Upvotes: 0
Reputation: 2338
This occurs because something, most likely eclipse, has a lock on the file during refresh so when maven tries to clean (i.e. delete the target directory), it fails. Don't refresh automatically; I typically only have eclipse refresh the workspace when it initially runs.
Upvotes: 1