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

前端 未结 14 852
离开以前
离开以前 2020-12-24 00:09

I\'m getting this warning in Eclipse:

Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported or published. Runtime ClassNotFo

相关标签:
14条回答
  • 2020-12-24 01:01

    http://geertschuring.wordpress.com/2009/03/05/why-the-maven2_classpath_container-will-not-be-exported-or-published/

    On certain occasions Eclipse will present you with the following warning:

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

    So solve this, do the following:

    Open the properties of the project that generates this warning
    Click on “Java Build Path”
    Click on the tab “Order and Export”
    Enable “Maven Dependencies”
    Click on “Ok”
    Open the “Problems” view
    Select the warning we are trying to solve, and press “Ctrl-1″
    Click on “Ok”
    

    The problem is now solved. It may take some time before the warning disapears because the project needs to rebuild before it goes away.

    0 讨论(0)
  • 2020-12-24 01:01

    Most answers, including the currently accepted one, only provide a temporary solution to this issue: every time I chose Maven > Update Project… and leaving the option 'Update project configuration from pom.xml' on, the warning came back.

    However, after installing m2e-wtp - Maven Integration for WTP in Eclipse 4.5 (Mars) and issuing Update Project… again, while leaving the option selected, the warning (and resulting error) went away.

    0 讨论(0)
  • 2020-12-24 01:01

    None of the answers helped in my case. Every time I update the project, m2e will delete the entry from the .classpath file which disables the warnings.

    I've now filed a bug report: https://bugs.eclipse.org/bugs/show_bug.cgi?id=537401

    0 讨论(0)
  • 2020-12-24 01:03

    Adding to the pom.xml:

    <properties>
        <java.version>1.8</java.version>
    </properties>
    

    helped me in this case and also with Dynamic Web Module and other issues.

    0 讨论(0)
  • 2020-12-24 01:05

    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!

    0 讨论(0)
  • 2020-12-24 01:08

    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.

    0 讨论(0)
提交回复
热议问题