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.
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. 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.
Exclude the transitive dependencyOpen the dependency POM and find the transitive dependency you want to exclude. Copy groupId and artifactId . In your project POM, underneath your active dependency, enter exclusions and using code completion paste the copied info of the dependency you want to exclude.
mvn clean install is the command to do just that. You are calling the mvn executable, which means you need Maven installed on your machine.
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.
Update For windows user following
> mvn clean [package|install] --projects \!groupId:artifactId
Another comment on the accepted answer, don't forget to escape the exclamation sign when running the command in bash:
> mvn clean install -pl \!module,\!module/submodule,\!groupId:artifactId
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With