views:

606

answers:

1

I have a multi module maven project and the directory structure is hierarchical. Some modules have dependencies on others. I have added the dependent modules to the dependency section of the project's POM. However, in order to resolve those dependencies, I need to import the parent project, and select Project Properties > Maven and select "Enabled Modules." Is this normal? Why wouldn't the project just resolve the dependent project in the workspace?

thanks, Jeff

+2  A: 

However, in order to resolve those dependencies, I need to import the parent project, and select Project Properties > Maven and select "Enabled Modules." Is this normal?

No. When you import your projects, unfold the Advanced part and make sure that Resolve Workspace projects is checked (that should be the default though). You can also change this setting at the project level. Just right-click on a project, select Properties > Maven and verify that Resolve dependencies from Workspace projects is checked.

UPDATE: Answering a question asked in a comment by the OP. From http://m2eclipse.sonatype.org/dependency-management.html about Include modules:

When enabled, dependencies from all nested modules are added to the "Maven Dependencies" container and source folders from nested modules are added to the current project build path when running "Update Sources" action. This option is enabled when you import multiple Maven projects as single Eclipse project, e.g. when "Separate projects for modules" option is turned off in the project import wizards.

Pascal Thivent
That's what I thought. Not sure why this was acting up.
Jeff Storey
When would you use the Include Modules checkbox then?
Jeff Storey
What what? Where is this checkbox?
Pascal Thivent
It's under Project Properties > Maven. I'm using version 0.9.8.200905041414 of the plugin.
Jeff Storey
Ah, I see. It looks like it's useful when using a single eclipse project to manage multiple maven projects.
Jeff Storey