Maven version 3.2.1 added this feature, you can use the -pl
switch (shortcut for --projects
list) with !
or -
(source) to exclude certain submodules.
mvn -pl '!submodule-to-exclude' install
mvn -pl -submodule-to-exclude install
Be careful in bash the character ! is a special character, so you either have to single quote it (like I did) or escape it with the backslash character.
The syntax to exclude multiple module is the same as the inclusion
mvn -pl '!submodule1,!submodule2' install
mvn -pl -submodule1,-submodule2 install
EDIT Windows does not seem to like the single quotes, but it is necessary in bash ; in Windows, use double quotes (thanks @awilkinson)
mvn -pl "!submodule1,!submodule2" install
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…