Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Maven how do I build the modules, but not the aggregator project itself?

Tags:

maven

maven-3

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?

like image 630
Chris Beach Avatar asked Jun 19 '12 11:06

Chris Beach


People also ask

What is the difference between Maven module and Maven project?

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.

Can two Maven modules depend on each other?

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.

What is the packaging type of an aggregator pom in a multi-module Maven project?

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.

What is Maven aggregator project?

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.


1 Answers

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.

like image 65
Michał Kalinowski Avatar answered Sep 30 '22 18:09

Michał Kalinowski