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 ...

Get Apache Maven Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.