in general, you would like to release mvn clean on the parent pom, which will also clean up all children defined as modules.
If you donβt have and donβt need such a parent, you need to use brute force for this, which means something like
for dir in yourdirectory; do cd $dir if [ -f pom.xml ]; then mvn clean fi done
source share