Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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> 
like image 411
Andre Cardoso Avatar asked Aug 15 '11 22:08

Andre Cardoso


People also ask

Does Maven add to classpath?

Maven Archiver can add the classpath of your project to the manifest.

How do you add classpath to a project?

To add a library reference to the project classpath, follow this procedure: Right-click on the project in the Project Explorer view and select Properties from the drop-down menu. This will open the Propertis dialog. On the Propertis dialog, select the Java Build Path from the list of properties.


1 Answers

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.

like image 129
Nicola Musatti Avatar answered Oct 06 '22 07:10

Nicola Musatti