Loading...

Build single module from multi module pom

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

Used:   maven v2.1 

If case you want to test or build only a project (sub module) you have several options since Maven 2.1

This example maven project has sub module which generates an rpm package.

coolapp
|-- api
|-- impl
|-- db
|-- ear
|-- deploy
    |-- rpm
    |-- deb
    |-- osgi

Invoking the maven goal rpm:rpm applies only to the project rpm.

Invoking on path coolapp

mvn rpm:rpm --projects deploy/rpm
# short form
mvn rpm:rpm -pl deploy/rpm

If you want to also build dependencies

mvn rpm:rpm --projects --also-make deploy/rpm
# short form
mvn rpm:rpm -pl -am deploy/rpm

Take also a look at advanced reactor options.

Please remember the terms for blog comments.