Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported

Viewed 96679

I'm getting this warning in Eclipse:

Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result

After searching I found that I need fix export. I did it.

Eclipse Java Build Path properties

But this warning persists! What else can be done to fix it? Thanks.

16 Answers

Simply right click on the warning and do a quick fix

enter image description here

You can then review the .classpath file changes from source control

enter image description here

Using Eclipse Photon, the configuration below fixed the problem for me: Window > Preferences > Maven > Java EE Integration > Enable Java EE Configuration

Note that I disabled this option before receiving the warning Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported

All other options may not be checked if you do not need them.

The warning does not reappear after a Maven update.

I had the same issue after updating my JDK in project and resolved it by replacing my .classpath file with previous one. I noticed the following changes in my .classpath file

    <attributes>
        <attribute name="maven.pomderived" value="true"/>
        <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
    </attributes>

The second line was missing from above code

<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

This line was missing

    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
    <attributes>
        <attribute name="owner.project.facets" value="java"/>
    </attributes>
</classpathentry>

These lines were added so I manually removed them and it all worked again.

I was in the same situation that Aaron Digulla.

I am learning Maven and noticed that this issue manifested when

  • I added a pom packaging line, for war
  • updated the project
  • removed said line and updated again

I noticed that the file ".settings/org.eclipse.wst.common.component" was one of the leftover files after this operation. When I removed this one in particular and updated the project, the Warning would go away and it wouldn't come back unless I repeated it all again.

I had the same problem in a maven project with dynamic web project, but I solved it like this.

  1. Right click on the project

  2. Properties

  3. Deployment Assembly and button "add".

    enter image description here

  4. Select Directive Type "Java Build Path Entries"

    enter image description here

  5. Select "Maven Dependecies" and select button finish

    enter image description here

  6. This way when the "war" file of the final project is created, all the "jar" files from the "Maven Dependencies" directory will be added.

    enter image description here

I came across this issue too! I Believe that eclipse adds the same deps twice. once in the

Maven Dependencies

Group and another in the form of

M2_REPO/ ...

You must remove the last one in the

Properties -> Java Buil Path -> Libraries

for the error to dissapear!

Related