I would like to build modules via an aggregator, but avoid the aggregator project being built itself. In my use-case, the aggregator is a dummy wrapper simply used for grouping together a build, and has no significance as a project in its own right
Is it possible to remove the aggregator from the reactor somehow?
There is very little difference between Maven Module and Maven Project. When we create a Maven module it is mandatory to specify a parent project. As soon as we specify the parent project, <modules> … </module> is added in pom.
Because modules within a multi-module build can depend on each other, it is important that the reactor sorts all the projects in a way that guarantees any project is built before it is required. The following relationships are honoured when sorting projects: a project dependency on another module in the build.
2. Maven's Multi-Module Project. A multi-module project is built from an aggregator POM that manages a group of submodules. In most cases, the aggregator is located in the project's root directory and must have packaging of type pom.
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.
AFAIK there's no way of doing that. But I believe your real problem is that this aggregator artifact is deployed to remote repository along with other modules and it doesn't make sense, as you said. What I recommend then is to set <skip>true</skip>
for maven-deploy-plugin
in aggregator's pom.xml
to disable its deploy, like this:
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
maven-deploy-plugin supports this since version 2.4.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With