Book Image

Apache Maven Cookbook

Book Image

Apache Maven Cookbook

Overview of this book

Table of Contents (18 chapters)
Apache Maven Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Understanding project aggregation


A key difference between inheritance and aggregation is that, aggregation is defined with a top-down approach, whereas inheritance is defined the other way around. In Maven, project aggregation is similar to project inheritance, except that the change is made in the parent pom instead of the child pom.

Maven uses the term module to define a child or subproject, which is part of a larger project. An aggregate project can build all the modules together. Also, a Maven command run on the parent pom or the pom file of the aggregate project will also apply to all the modules that it contains.

How to do it...

  1. Open a project that has aggregation; in our case project-with-aggregation. This has a subfolder named aggregate-child, which is the module that is aggregated by the parent project.

  2. Update the parent pom as follows:

        <groupId>com.packt.cookbook</groupId>
        <artifactId>project-with-aggregation</artifactId>
        <packaging>pom&lt...