Here is an example of the approach mentioned by Ondra Žižka using mvn clean install and bash.
Note that it ignores pom packaging modules (since they are usually the roots of subtrees and usually cause additional, unnecessary modules to be created). He also searches for pom.xml files at 3 levels (for speed), assuming they are all parts of the same reactor, but this can be adapted to your project.
find . -maxdepth 3 -name pom.xml | xargs -I{} grep -iL -F "<packaging>pom</packaging>" {} | xargs dirname | grep -v target | sed -e 's/^.[/]*//g' | grep . > /tmp/mvn-modules.txt && git diff --name-only @{u}...HEAD | grep -o -F -f /tmp/mvn-modules.txt | xargs | tr ' ' ',' | xargs -I{} mvn clean install -U -pl {} -amd
In the @{u}...HEAD example, the links are changed in the current branch compared to the upstream, but this can be replaced with another diff (the <branchname> master example), if this is more suitable.
source share