Maven / M2Eclipse excludes my resources all the time

This is correct behavior. Current version of M2E provide their own contributor to the automatic build process inside the Eclipse IDE. This build process takes into account the maven lifecycle for generate-resources and process-resources etc... i.e. some project have plugins that generate resources from configuration and put in the compiled output folder.

The mechanism you are looking at in the Build Path only relates to the Eclipse IDEs built in mechanism to compile/assembly a set of input source folders into the output folders. If both Maven and Eclipse did this there would be conflicts/problems.

There is a link in the M2E FAQ about this exact point https://www.eclipse.org/m2e/documentation/m2e-faq.html#how-to-configure-proxy-and-location-of-maven-local-repository

If you are genuinely having problems with resources not being copied maybe we can work through why that is (since that is another matter), but your main question is about a common M2E FAQ point.

Maybe you want to upgrade to org.eclipse.m2e and Indigo as a lot of Maven complex maven issues/usage I have are mostly resolved or have an explained solution.

.

I would recommend you perform a "Run As -> Maven -> clean" and then a "Project -> Clean" then enable automatic bulding (this is to allow Eclipse based automatic build to take place, do not use Run As -> Maven to build to test this point). Now open a file manager outside eclipse and manually inspect the output folders for the resources that you did not think are being copied. You should find they are there just the same.

.

I agreed with the (probably Validation) warning about items in the target/** directory and whilst Eclipse has a way to manually exclude the target/** directory from validation this option does not stick beyond a project clean (when the target directory is deleted).

So it is somewhat annoying to be always waiting for validation of items in a large project.

Maybe I attempt to see if a Maven Eclipse connector plugin can be created provided to do this i.e. tie into the build lifecycle and automatically apply the Exclude Validation on the target folder.


T_T not a good solution. resources is not copied without maven-update


maven resources:resources phase marked ignored in Lifecycle Mappings will cause this problem.

As Miles pointed out above, eclipse don't copy the resource since it assumes maven will do it for you. Then if resources:resources phase which do the job in maven is not executed, you get a file not found exception at runtime.

to check this open

project->properties->maven->lifecycle mapping

and see whether resources:resources is marked ignored or not.

to solve it windows->preference->maven->lifecycle mapping-> open workspace lifecycle mappings metadata

then change

  <action>
    <ignore />
  </action>

to

  <action>
    <execute />
  </action>

for goal resources

reload metadata & update maven project

should solve the problem.