Workaround(s) for maven-war-plugin error: Failed to copy file for artifact

Sean Dawson picture Sean Dawson · Dec 25, 2012 · Viewed 8.9k times · Source

If I have simple maven webapp project in Eclipse that depends on another maven project in my workspace, I get the error...

Failed to copy file for artifact [group:artifact:jar:version:compile] (org.apache.maven.plugins:maven-war-plugin:2.3:exploded:make-war-exploded:compile) pom.xml /Project line xx Maven Build Problem

It's mentioned several places online (debated across maven teams about what part is broken, how to fix it, etc) - with the only workaround I've found being "disable workspace resolution." Uhm, ok, but that's why I have that project in my workspace - so it can be edited and the changes get picked up without having to install every time.

We just recently converted to using maven so I don't have much experience with it - and somehow there are projects in our SVN that don't give that error even using the same configuration (they were created by a consultant who isn't here anymore). I can't figure out what the differences are - I've used almost identical poms, tried different versions of eclipse / war plugin, added build helper / wtp integration, created the projects in different ways, compared the eclipse configuration files, etc. The only difference I can figure is that those are deployed and I don't do that at home.

I just want that error to go away (without disabling workspace resolution) so I don't have to ignore all errors or get a dialog to confirm continuing each time I run. It's probably something simple I missed / don't know.

Answer

andresmafra picture andresmafra · Feb 12, 2014

This can be a problem with the m2eclipse plugin. To resolve this:

Open Project->Properties->Maven. Uncheck 'Resolve dependencies from Workspace projects' which solved the problem with the war plugin in m2eclipse.