Radu Toader
Radu Toader

Reputation: 1561

How to generate eclipse project from maven with "Maven Dependencies" instead of "Referenced Libraries" "M2_REPO/.."

How can I generate eclipse project from maven like :

mvn eclipse:eclipse 

but I need to get .classpath file like this :

<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
    <attributes>
        <attribute name="maven.pomderived" value="true"/>
        <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
    </attributes>
</classpathentry>

instead of having all dependencies from pom like this :

<classpathentry kind="var" path="M2_REPO/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar" sourcepath="M2_REPO/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0-sources.jar">
<attributes>
  <attribute value="jar:file:/home/tr/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0-javadoc.jar!/" name="javadoc_location"/>
</attributes>

....

Upvotes: 1

Views: 268

Answers (1)

kisna
kisna

Reputation: 3127

The problem is conflicting M2E and mvn eclipse classpath entries. If you run eclipse:eclipse as well, then you will see referenced libraries added to your classpath.

The way to import is to run mvn eclipse:clean only on your project from a command line first and then import as maven project using eclipse M2E maven plugin to see maven dependencies "without referenced libraries". Otherwise, you will end up doing Maven -> Update project or remove "referenced libraries" manually from all your maven modules.

Upvotes: 1

Related Questions