Skip to content

Instantly share code, notes, and snippets.

@gaurav9822
Created November 10, 2023 04:06
Show Gist options
  • Save gaurav9822/fa43c12e58d0fd2e4246ae6446dc5ab0 to your computer and use it in GitHub Desktop.
Save gaurav9822/fa43c12e58d0fd2e4246ae6446dc5ab0 to your computer and use it in GitHub Desktop.
Clean all maven target folder recursively from your main projects directory
#!/bin/bash
# Find all directories containing pom.xml
directories=$(find . -type f -name pom.xml -exec dirname {} \;)
# Iterate over each directory and run mvn clean
for dir in $directories; do
echo "Cleaning $dir"
(cd "$dir" && mvn clean)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment