How do I exclude certain modules from a Maven build using the commandline

Bastl picture Bastl · Nov 7, 2012 · Viewed 55.7k times · Source

Is there a way to exclude some modules from a big reactor build, similar to -pl ?

Here are a number of ways to do it persistently:

How to exclude a module from a Maven reactor build?

I want to do it from shell, or at least without modifying the poms, which I am not allowed to change.

Answer

Yogesh_D picture Yogesh_D · Apr 1, 2014

Maven 3.2.1 has added this feature, you can use to specify the exact projects you want (or to exclude the projects you don't want) -pl or --projects Here's how to exclude two:

-pl "!<modulename>,!<modulename2>"

for exclude certain modules. This can be comma separated list of values that you want to include/exclude.