Is there a way to selectively specify which modules to install while building a complete reactor project?
In essence I would like to package the complete reactor content but only install a few.
Is there a way to selectively specify which modules to install while building a complete reactor project?
In essence I would like to package the complete reactor content but only install a few.
There are many option that allow you to manage a modulare project in maven.
To Resume Build
The -rf or --resume-from option can come in handy if you want to tell the Maven Reactor to resume a build from a particular project.This can be useful if you are working with a large multimodule project and you want to restart a build at a particular project in the Reactor without running through all of the projects that precede it in the build order.
Example mvn --resume-from yourmodule install
Specifying a Subset of Projects
The -pl or --projects option allows you to select a list of projects from a multimodule project. This option can be useful if you are working on a specific set of projects, and you’d rather not wait for a full build of a multi-module project during a development cycle.
Example mvn --projects yourmodule1,yourmodule2 install
Making a Subset of Projects
If you wanted to run a portion of the larger build, you would use the -pl or --projects option with the -am or --also-make option. When you specify a project with the -am option, Maven will build all of the projects that the specified project depends upon (either directly or indirectly). Maven will examine the list of projects and walk down the dependency tree, finding all of the projects that it needs to build.
Example mvn --projects sample-services --also-make install
You can find more detail on Maven: The complete references
No; a single invocation of Maven will use the same phases for all modules.
You could chain invocations; for example:
mvn package && mvn -pl web-app install
But then the dependencies of web-app
would be taken from your local repository and not from the reactor used in the first invocation.
The safest option would be (as in Maven Modules + Building a Single Specific Module) to use -am
and -pl
to install only a specific module along with all its dependencies:
mvn -pl web-app -am install
Note that this will still install other modules, but only those necessary to build web-app
.