You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Jankiraman, Radhakrishnan" <rj...@emptoris.com> on 2010/08/20 19:31:00 UTC

Aggregation / Inheritance ?

Hi,

We have  the following project structure

A
 + B ( packaging type jar )
 + C
 + D

Where D has a dependency on B.

The packaging type for 'A' is set as 'pom' and B, C  and D are configured as modules. In addition, the poms in B, C and D also refer to A's pom through the parent element. If I understand this, the former ensures aggregation kicks-in and the latter ensures that child poms inherit stuff from the parent pom.

Now when I run mvn package from within A, when the dependencies are resolved for 'D', the dependency on B is resolved by including the B\target\B.jar jar file. However, when I run the package from within D, the dependency on B is resolved from the local repository.

Why doesn't maven detect that D is a sub module of the aggregation in 'A'.  It manages to get to the A pom, so it might as well see that D is part of A's aggregation and then resolve the dependencies as per aggregation ?

Is there way to do achieve this ?

Thanks,
Rk

Re: Aggregation / Inheritance ?

Posted by Wayne Fay <wa...@gmail.com>.
> for 'D', the dependency on B is resolved by including the B\target\B.jar
> jar file. However, when I run the package from within D, the dependency
> on B is resolved from the local repository.

This is simply how Maven works when it comes to building multi-module
projects. When building from A, it "knows" about B, but not when you
build from D.

You may want to look at the reactor plugin and see if you can make
this work like you prefer:
http://maven.apache.org/plugins/maven-reactor-plugin/
http://www.sonatype.com/people/2009/10/maven-tips-and-tricks-advanced-reactor-options/
http://brettporter.wordpress.com/2008/09/19/reactor-my-new-favourite-maven-plugin/

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org