Search code examples
eclipsemavenclasspath

Maven does not add classpath to Eclipse project


I have a maven project, that I'm working on Eclipse.

I use maven eclipse:eclipse to generate the classpath, but ... it NEVER adds the classpath on the eclipse project. I've tried the maven-eclipse-plugin, I've tried the M2Eclipse plugin, but it doesn't matter what I do, I can't get the classpath entries to start working. I have many build errors, even thought the maven builds the ear perfectly.

Any guidelines?

Thanks for any answer!

UPDATE: Here's my root classpath:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="core/src/main/java"/>
    <classpathentry excluding="**" kind="src" output="target/classes" path="core/src/main/resources"/>
    <classpathentry kind="src" path="client/src/main/java"/>
    <classpathentry kind="src" path="client/src/main/resources"/>
    <classpathentry kind="src" path="junit_server/src/main/java"/>
    <classpathentry kind="src" path="initializer/src/main/java"/>
    <classpathentry kind="src" path="initializer/src/main/webapp"/>
    <classpathentry kind="src" path="site/src/main/webapp"/>
    <classpathentry kind="src" path="core/src/test/java"/>
    <classpathentry kind="src" path="core/src/test/resources"/>
    <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry exported="true" kind="var" path="M2_REPO"/>
    <classpathentry kind="output" path="target/classes"/>
</classpath>

UPDATE2: This is my .project:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>coreisp_back</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.m2e.core.maven2Builder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.m2e.core.maven2Nature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>

Solution

  • The setup generated by the Maven Eclipse plugin is not compatible with m2e/m2eclipse. If you want to use Maven and Eclipse together your best course is to remove any modification to your setup generated by the maven eclipse plugin and use m2e to import your Maven project.