2

The -am (also make dependencies) and -amd (also make dependents) command line options can be used together but they will not work transitively to e.g. make the dependents of a dependency. E.G. will

$ mvn  -amd -am -pl test:c clean

build b, c and d - but not a or e given the following reactor (groupId=test) module dependency graph:

dependency graph

I'd like to build all modules that could have been affected by a code change in e.g. c - is that possible in maven? I guess this is equivalent to all vertices that is reachable from c, i.e. in this case all modules except f and g.

slackhacker
  • 523
  • 4
  • 8
  • The question is what kind of problem are you trying to solv? Why is it necessary to select such dependency graph instead of simply building the project? – khmarbaise Oct 03 '18 at 08:34
  • It might be a valid scenario in a monorepo setup where you want not always build everything but rather use the dependency handling features of maven to just build what can have been affected (even though in the likely case of intertwined dependencies this maybe very well be the same as building the whole project) – slackhacker Oct 05 '18 at 06:35

1 Answers1

1

There aren't any options in Maven to achieve what you like to have. The -amd option will traverse the whole module tree below the specified module (c in your example). The -am option will traverse the path to the root of your module tree.

Stefan Ferstl
  • 5,135
  • 3
  • 33
  • 41