Issue
I use maven 3.2.3.
I have a multi-module project with three levels of nested modules. I want to build all first-level modules(with their submodules) except one. For this task I tried to use -pl option and specifying the module I want to exclude from the build using !moduleName.
What I have in result is that the specified module is excluded from the build, BUT submodules of that module are not.
Is it an expected behaviour and I should explicitly exclude all the nested submodules as well?
Solution
The short answer is: yes it is expected behavior.
The feature request that documents this change (allowing you to use !moduleName
to exclude a specific module from the build) is documented in issue MNG-5230.
In that request someone specifically asks for the functionality you are looking for:
how about excluding nested modules? I tried the new feature and it seems as though, when a top module is excluded, its nested modules are not.
and the answer there is:
Nested modules are not excluded by parent module.
So looks like you'll have to list them all individually.
If you are always excluding the same modules you could predefine this list in a profile that is either activated or deactivated as required. Details of this can be seen in this answer: https://stackoverflow.com/a/5542779/1570834
Answered By - DB5
Answer Checked By - Katrina (JavaFixing Volunteer)