Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported
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.
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.
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
I had the same problem; it vanishes after including
<packaging>war</packaging>
in the pom. There was no packaging at all.