1*55e87721SMatt Gilbride#!/bin/bash 2*55e87721SMatt Gilbride 3*55e87721SMatt Gilbrideset -e 4*55e87721SMatt Gilbride 5*55e87721SMatt GilbrideGENERATION_DIR=$(dirname -- "$0"); 6*55e87721SMatt Gilbride 7*55e87721SMatt Gilbride# Find all Maven modules (a directory that contains pom.xml) 8*55e87721SMatt Gilbridefind . -mindepth 2 -maxdepth 2 -name pom.xml |sort --dictionary-order | xargs dirname \ 9*55e87721SMatt Gilbride |sed -e 's|./||' | xargs -I '{}' echo " <module>{}</module>" > /tmp/repo-modules.txt 10*55e87721SMatt Gilbride 11*55e87721SMatt Gilbrideperl -0pe 's/<modules>.*<\/modules>/<modules>\n <\/modules>/s' ${GENERATION_DIR}/../pom.xml > ${GENERATION_DIR}/parent.pom.xml 12*55e87721SMatt Gilbrideawk -v MODULES="`awk -v ORS='\\\\n' '1' /tmp/repo-modules.txt`" '1;/<modules>/{print MODULES}' ${GENERATION_DIR}/parent.pom.xml > pom.xml 13*55e87721SMatt Gilbriderm ${GENERATION_DIR}/parent.pom.xml