maven module dependencies

Is the Maven project sync broken for dependencies between modules and inherited from the parent?

I've tried imported a Maven 2 project with a bunch of modules (trying both an exhaustive search and not). The parent POM has a bunch of dependencies. The POM for one module has an empty dependencies element, and it seems to have inherited all the parent JARs in Project Settings -> Modules -> module name -> Dependencies. However, the POM of another module lists a couple of the other modules in its dependencies element. It's dependencies in IDEA are almost empty: just the JDK and "Module source". It hasn't inherited the parent's JARs, and it doesn't even have the two modules listed in its POM.

The Maven compile lifecycle at the top level successfully compiles all the modules, but IDEA's compile fails because the module in IDEA is missing dependent classes (e.g., from JUnit 4, even though the parent module has JUnit 4 in its dependencies).

Is this a problem with how IDEA syncs with the Maven project? I'd like to avoid manually reconfiguring my IDEA project every time they change a POM. I have no experience with Maven, especially in IDEA, so maybe I'm just doing something wrong. Do I need to run the install lifecycle? I haven't tried that yet because I doubt it will pass the test lifecycle before I set up some databases.

4 comments

OK, running the top level install lifecycle phase and then resynchronizing the maven projects made those inherited dependencies appear. Then, closing and reopening the project made IDEA recognize the inter-module dependencies and be able to compile successfully.

Needing to do all that still seems broken to me, but maybe I'm doing something wrong, or maybe I'll understand after more experience with Maven.

0

there's a JIRA issue for something that matches your description but it was supposed to be fixed

0

What is the scope and the type of such missing dependencies?
Could you attach your poms, please?

0

I've attached the POM of the parent and one of the modules where I saw this problem.



Attachment(s):
pom.xml
pom.xml
0

Please sign in to leave a comment.