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

前端 未结 14 850
离开以前
离开以前 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 00:46

    I had the same problem; it vanishes after including

    <packaging>war</packaging> 
    

    in the pom. There was no packaging at all.

    0 讨论(0)
  • 2020-12-24 00:50

    I had tried both of the options but only the latter is what you need:

    • Mark the associated raw classpath entry as a publish/export dependency
    • Exclude the associated raw classpath entry from the set of potential publish/export dependencies

    If you export the dependency, refreshing the project configuration via Maven -> Update Project Configuration context menu will cause the warning to return. In this case you need to edit the .classpath file by hand:

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

    Simply delete have the attribute exported="true" and confirm by refreshing the project configuration.

    0 讨论(0)
  • 2020-12-24 00:53

    I wasn't able to solve the problem with the quickfix in Eclipse Luna. The problem disappeared after removing the Project Facet "Dynamic Web _Module". In Windows -> Preferences -> Project Facets.

    enter image description here

    P.S. Packaging as War also solved the issued but it was suppoused to be a JAR and I was puzzled why some projects worked ok and some didn't.

    And by the way, the warning was real. It caused a ClassNotFoundExceptions exceptions in the server that made it unsusable when other projects referenced this.

    0 讨论(0)
  • 2020-12-24 00:58

    You can right click on the warning, choose quickfix and choose one of the following:

    • Mark the associated raw classpath entry as a publish/export dependency.
    • Exclude the associated raw classpath entry from the set of potential publish/export dependencies.

    As you will not have eclipse publishing/exporting the project it is safe to exclude it. But either way it makes no difference

    Step by step screenshots:
    http://publib.boulder.ibm.com/infocenter/radhelp/v8/index.jsp?topic=/com.ibm.javaee.doc/topics/tlooseclasspath.html

    0 讨论(0)
  • 2020-12-24 00:59

    I have a simple way to solve this problem:

    1. Delete the project from your Eclipse.
    2. Into the work space where the project is located.
    3. Delete the items selected in the following image. Just leave src and pom.xml.

    4. Re-import the project in your Eclipse.

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

    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.

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