Loading...

Build single module from multi module pom

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.