0

I have module setup:

grandparent -> parent -> child1
      \               -> child2
       \
        --> child3
        --> child4

I would like to build everything under parent.

I have tried:

mvn install --projects ":parent"

but that only builds parent, and none of the submodules of parent.

The modules are setup correctly because

mvn install

builds all submodules.

For now my workaround is to enumerate all submodules of parent:

mvn install --projects ":parent,:child1,:child2"

This differs from Maven Modules + Building a Single Specific Module because:

  1. Here I have three levels are parent projects. The suggested question only has two levels.
  2. -am (also make) would build too much in my case because child2 depends on child3. I only want child1 and child2 built (parent can be built or not built. I don't care about that one).
joseph
  • 2,429
  • 1
  • 22
  • 43
  • 1
    Does this answer your question? [Maven Modules + Building a Single Specific Module](https://stackoverflow.com/questions/1114026/maven-modules-building-a-single-specific-module) – Chin Huang Aug 23 '22 at 20:01
  • Thanks for sharing. I learned about -am (also make) from it. However, in that question, there is only one level of nesting. -am (also make) does not solve my issue since it would build more than I need. – joseph Aug 23 '22 at 21:49
  • 1
    you may run `mvn -f parent install`, however it is not the same as `mvn install -pl ":parent,:child1,:child2"` (for example in that case it won't resolve grandparent pom) – Andrey B. Panfilov Aug 23 '22 at 23:11
  • That might work! Thank you. The parent/pom.xml has `` entry that points to grandparent so the grandparent pom should be resolved. – joseph Aug 24 '22 at 14:01

0 Answers0