Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Indigo with m2e can't find maven dependencies in a multi-module project

Tags:

eclipse

m2e

I've created a multi-module project using Indigo with m2e 1.0. One of the child modules has a dependency on the other. It all builds correctly under maven.

Eclipse, however, can't find any of the classes that this module uses from the dependency .jar. The project properties shows the artifact under Maven Dependencies, but it does not show the actual .jar file itself.

I added the dependency with the Maven menu for this project.

The .project and .classpath got generated automagically at some point. I did not have to run mvn eclipse:eclipse or mvn eclipse:m2e (or whatever the goal is for m2e). The .classpath doesn't have the dependent .jar in it, but it does have org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER.

I've tried all the options under the Maven menu (update dependencies, update configuration) and refreshing the project. I've closed and re-opened Eclipse. It still shows errors.

This makes Eclipse worthless as a Java editor in multi-module projects. I could manually add the dependency .jar in the .classpath, but this defeats the purpose of integration Eclipse and Maven with m2e.

Is there any solution for this in Eclipse?

Thanks.

like image 891
Dean Schulze Avatar asked Dec 22 '11 06:12

Dean Schulze


1 Answers

The answer turned out to be the last answer to this question given by Jody Box. It's pretty bizzare that in order for Eclipse to resolve dependencies from another project in the Workspace that you have to uncheck the "Resolve dependencies from Workspace projects" checkbox.

I know mvn can be convoluted but this checkbox is doing the opposite of what it says.

like image 155
Dean Schulze Avatar answered Nov 17 '22 13:11

Dean Schulze