Red Hat Training

A Red Hat training course is available for Red Hat Fuse

3.3. Create an Aggregate Maven Project

Aggregate POM

A complete application typically consists of multiple Maven projects. As the number of projects grows larger, however, it becomes a nuisance to build each project separately. Moreover, it is usually necessary to build the projects in a certain order and the developer must remember to observe the correct build order.
To simplify building multiple projects, you can optionally create an aggregate Maven project. This consists of a single POM file (the aggregate POM), usually in the parent directory of the individual projects. The POM file specifies which sub-projects (or modules) to build and builds them in the specified order.

Parent POM

Maven also supports the notion of a parent POM. A parent POM enables you to define an inheritance style relationship between POMs. POM files at the bottom of the hierarchy declare that they inherit from a specific parent POM. The parent POM can then be used to share certain properties and details of configuration.
The details of how to define and use a parent POM are beyond the scope of this guide, but it is important to be aware that a parent POM and an aggregate POM are not the same thing.

Recommended practice

Quite often, you will see examples where a POM is used both as a parent POM and an aggregate POM. This is acceptable for small, relatively simple applications, but is not recommended. In general, it is better to define separate POM files for the parent POM and the aggregate POM.

Create an aggregate POM

To create an aggregate POM for your getting started application, use a text editor to create a pom.xml file in the get-started directory and add the following contents to the file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">

  <name>Getting Started :: Aggregate POM</name>
  <description>Getting Started example</description>


As with any other POM, the groupId, artifactId, and version must be defined, in order to identify this artifact uniquely. But the packaging must be set to pom. The key portion of the aggregate POM is the modules element, which defines the list of Maven sub-projects to build and defines the order in which the projects are built. The content of each module element is the relative path of a directory containing a Maven project.

Building with the aggregate POM

Using the aggregate POM you can build all of sub-projects in one go, by entering the following at a command prompt:
cd get-started
mvn install