saravana_pc saravana_pc - 1 year ago 102
Java Question

m2eclipse not copying src/main/resources to target

I have a maven project and I have installed m2eclipse. When I build the project, the files inside src/main/resources are not getting copied into target/classes folder.
Any help is highly appreciated.

Answer Source

After reading all your comments about when resources get copied and when they don't (i.e., everything works fine until Eclipse build gets called), it's very possible that maven2Builder is disabled. You could have maven2Nature which neatly configures your classpath, but if you disable maven2Builder, only sources will be compiled and copied to target/classes (or whatever is configured in your .classpath) due to active Java Builder.

Consider a very simple demo-project configuration (.project file in Eclipse project root):

<?xml version="1.0" encoding="UTF-8"?>

In this example, I have commented maven2Builder which results in exactly the same behavior you are getting.

I usually like to see the actual .project and .classpath file contents, but it all can be accessed via Project Properties. You will find a 'Builders' section in you project properties, and there should be 'Maven Project Builder' checkbox item.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download