Eclipse – Missing Maven dependencies in Eclipse project

eclipsem2eclipsemaven-2

We have a project set up with maven for resolving dependancies. It usually works fine, but now I am trying to compile and run it on a new PC and I have problem with missing dependencies in Eclipse.

What is funny is that if I run "mvn package" in console or in eclipse, it works fine and even produces war containing all necessary jars. Only Eclipse complains with "The project was not built since its build path is incomplete. Cannot find the class file for org.slf4j.Logger…". If I compare the project with some other computer (where project works fine), I notice that there are quite a few libraries missing under "Maven dependencies" listing in Eclipse. Eventhough they are in the packaged war and they can be found also under repository folder.

So, the jar-s are there just Eclipse won't list them all under "Maven dependencies". What can I do?

Computer is running on Windows 7 with 64bit java & eclipse.

Best Answer

Well, I tried everything posted here, unfortunately nothings works in my case. So, trying different combinations I came out with this one that solved my problem.

1) Open the .classpath file at the root of your eclipse's project.

2) Insert the following entry to the file:

<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
            <attribute name="org.eclipse.jst.component.nondependency" value=""/>
        </attributes>
</classpathentry> 

Then, rebuild your project at eclipse (Project->Clean-Build). You now can check at the Java Build Path of you project at the Libraries tab the Maven Dependencies included: enter image description here