Hi,

i'm trying to understand the handling of dependencies/aggregation in
Maven...

So i've setup the following structure:

  +--- root (root pom)
          +--- m1
                   +--- m1.1
                   +--- m1.2
                   +--- m1.3
                   +--- m1.4
                   +--- m1.5
          +--- m2
                   +--- m2.1
                   +--- m2.2
                   +--- m2.3
                   +--- m2.4
                   +--- m2.5
          +--- m3
                   +--- m3.1
                   +--- m3.2
                   +--- m3.3
                   +--- m3.4
                   +--- m3.5
          +--- m4
                   +--- m4.1
                   +--- m4.2
                   +--- m4.3
                   +--- m4.4
                   +--- m4.5

The root-pom has only modules listed (m1, m2, m3, m4)...
The m1 (m2, m3, m4) has a list of modules as well ( m1.1, m1.2 ...
m1.5)...m1 has defined the parent (root-pom)...and the modules m1.1 till
m1.5 has the parent m1 whereas the m2.1 till m2.5 has the parent m2...and so
on...
The modules m1.1 till m4.5 are simple packages which have default packaging
type (jar)...and contain a simple class and of course a test case for test
purposes.

So if i call mvn install on the root pom everything works as expected ....

So my next step was to define a dependency of one module to an
other...(m3.2)...so in m3.2 pom i used the following:
  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>m2.1</artifactId>
      <version>${project.version}</version>
    </dependency>
  </dependencies>

Ok...just tried to build...mvn install as expected the reactor order
changed....


But now i tried something different. I defined the dependency in m3.2's pom
to use m4 as dependency:

  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>m2.1</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>m4</artifactId>
      <version>${project.version}</version>
      <type>pom</type>
    </dependency>
  </dependencies>

Ok..tried to build mvn install and was a little bit confused...

The order in the reactor has changed, but only the module m4 itself has been
built before m2 instead of all sub-modules of m4...what i got was the
following:

 [INFO]
------------------------------------------------------------------------
 [INFO] Reactor Summary:
 [INFO]
------------------------------------------------------------------------
 [INFO] ModuleTest :: Parent .................................. SUCCESS
[3.323s]
 [INFO] ModuleTest :: M1 ...................................... SUCCESS
[0.031s]
 [INFO] ModuleTest :: M1 :: M1.1 .............................. SUCCESS
[2.941s]
 [INFO] ModuleTest :: M1 :: M1.2 .............................. SUCCESS
[1.216s]
 [INFO] ModuleTest :: M1 :: M1.3 .............................. SUCCESS
[0.867s]
 [INFO] ModuleTest :: M1 :: M1.4 .............................. SUCCESS
[0.963s]
 [INFO] ModuleTest :: M1 :: M1.5 .............................. SUCCESS
[0.672s]
 [INFO] ModuleTest :: M2 ...................................... SUCCESS
[0.034s]
 [INFO] ModuleTest :: M2 :: M2.1 .............................. SUCCESS
[0.932s]
 [INFO] ModuleTest :: M2 :: M2.2 .............................. SUCCESS
[0.703s]
 [INFO] ModuleTest :: M2 :: M2.3 .............................. SUCCESS
[0.777s]
 [INFO] ModuleTest :: M2 :: M2.4 .............................. SUCCESS
[0.740s]
 [INFO] ModuleTest :: M2 :: M2.5 .............................. SUCCESS
[0.745s]
 [INFO] ModuleTest :: M3 ...................................... SUCCESS
[0.035s]
 [INFO] ModuleTest :: M3 :: M3.1 .............................. SUCCESS
[0.748s]
 [INFO] ModuleTest :: M4 ...................................... SUCCESS
[0.035s]
 [INFO] ModuleTest :: M3 :: M3.2 .............................. SUCCESS
[1.023s]
 [INFO] ModuleTest :: M3 :: M3.3 .............................. SUCCESS
[0.763s]
 [INFO] ModuleTest :: M3 :: M3.4 .............................. SUCCESS
[0.668s]
 [INFO] ModuleTest :: M3 :: M3.5 .............................. SUCCESS
[0.694s]
 [INFO] ModuleTest :: M4 :: M4.1 .............................. SUCCESS
[0.724s]
 [INFO] ModuleTest :: M4 :: M4.2 .............................. SUCCESS
[0.748s]
 [INFO] ModuleTest :: M4 :: M4.3 .............................. SUCCESS
[0.679s]
 [INFO] ModuleTest :: M4 :: M4.4 .............................. SUCCESS
[0.876s]
 [INFO] ModuleTest :: M4 :: M4.5 .............................. SUCCESS
[0.660s]
 [INFO]
------------------------------------------------------------------------

Maybe i misunderstand the usage of a module ...or do i have to give simply
the modules m4.1...m4.5 as dependency instead of using m4?

The m4 module is a aggregation of multiple modules (m4.1...m4.5) which are
needed as dependency so it would be nice just to give m4 as dependency....

Or does exist an other solution to handle such a problem?

Kind regards
Karl Heinz Marbaise
-- 
View this message in context: 
http://old.nabble.com/Dependencies-and-Aggregation-tp28214892p28214892.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to