Here's my project structure:
├── module_1
├── sub_module
├── module_11
├── module_12
├── module_13
├── module_2
Now if I build it with the following command:
$~ mvn package -pl sub_module
It would only build sub_module but not its children module.
The only way to build module_11/module_12/module_13
is to specify them explicitly as following:
$~ mvn package -pl sub_module,sub_module/module_11,sub_module/module_12,sub_module/module_13
This is inconvenient for me, just wondering if there is an easier way approach this?
Check if adding the -am
or -amd
option helps
mvn clean package -pl sub_module -am
mvn clean package -pl sub_module -amd <== (confirmed by the OP)
see at Maven Tips and Tricks: Advanced Reactor Options:
-am, --also-make
If project list is specified, also build projects required by the list
-amd, --also-make-dependents
If project list is specified, also build projects that depend on projects on the list.
I've got two kludges that may fit:
Run build on specific pom file using -f
:
$ mvn package -f module_1/submodule
Or cd
into required module and simply build it:
$ pwd
/module_1
$ cd submodule
$ mvn package
It, howewer, takes more pain moving across directories.
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