It appears that I'm missing something critical here, so please help me out.
I have a standard
multi-module project like this. (I'm using Maven 2.0.9, JDK5).
parent (P) -
|- module A
|- module B
|- module C
A,B,C all inherit from the parent P.
Now in my parent POM (P): I have a dependencyManagement section in the POM.
<depedencyManagement>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
<dependency>
<... bunch of others ...>
<dependencies>
</dependencyManagement>
Now in module A (I have a dependency on log4j), so only thing that I provide
is (notice no version):
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<dependency>
<... bunch of others ...>
<dependencies>
Now in module B depends on module A so I have this in my dependency:
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>module_A</artifactId> <!-- NOTICE MODULE A -->
<version>${project.version}</version>
<dependency>
<... bunch of others ...*but no log4j*>
<dependencies>
NOTE: I do use log4j in B, but it got transitively pulled in. So far so
good.
Now Module C, depends on Module B. So what I have is:
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>module_B</artifactId> <!-- NOTICE MODULE B
-->
<version>${project.version}</version>
<dependency>
<... bunch of others ...>
<dependencies>
Now, I do use some log4j calls (LogFactory), but for some reason log4j does
not
get pulled in transitively??? I have to explicitly give a dependency on
log4j *or*
module_A to get it to compile??
My first that was, all transitive dependencies on module_B should get pulled
in which
means module_A and in turn its transitive dependency log4j. But nothing of
this sort
is happening? Any ideas? Is it the dependecyManagement section (which has
the version)
that is messing me up, since C does inherit from P?
Thanks
Mohan K