score:27

Accepted answer

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.

score:-5

that's the typical problem with maven projects configured in eclipse that are changed its configuration or saved inappropriately.

normally i'll edit my .classpath file and check the references for the build path, etc.

so in your case, i think you'll need to delete your classpathentry with those org.eclipse.m2e.maven2_classpath_container reference inside.

score:-1

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.

score:-1

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!

score:0

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.

score:0

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.

score:0

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.

score:0

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

score:1

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.

score:1

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

score:3

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.

    enter image description here

  4. re-import the project in your eclipse.

score:5

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.

score:5

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

score:10

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.

score:15

i had the same problem; it vanishes after including

<packaging>war</packaging> 

in the pom. there was no packaging at all.

score:37

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


Related Query