Search code examples
maven-2eclipse-pluginm2eclipse

M2Eclipse can't find dependencies when they are projects in the same workspace


I know there are various known issues with the M2eclipse plugin and I guess this is just one of them. Hopefully someone is aware of a solution or workaround.

We have like 30 projects in our workspace but for clarity lets assume there are only 2: A en B.

B includes A as a dependency in the pom.xml of B. The problem we have is that in eclipse the classes of A can't be found so you get compilation errors. However, if you 'mvn install' A to deploy it in the local repository and the close project A then everything is fine; no compilation errors. So, if A exists in the project M2Eclipse does not seem to be able to correctly set the classpath in eclipse.

To make things stranger, we also have project C that also depends (in exactly the same way as B) on project A but here we have no compilation errors. We can't identify anything meaningful difference between project B or C; as said, they include A in the same manner.

thanks for your help, Stijn

P.S. I'm using version 0.10.2.20100623 of the plugin


Solution

  • RESOLVED

    finally, after agonizing hours I found the cause. I was focussing on the .classpath and the .settings files but the problem was located in the .project file. This file in project A was missing following entry in the tag natures:

    <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
    

    Adding this resolved the issues.