-
-
Save polo7/4e4bb3a7359f6f64e34c90899068ccbf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Counters for Maven and Gradle projects | |
| maven_count=0 | |
| gradle_count=0 | |
| echo "Starting to clean projects..." | |
| # Recursively find directories containing pom.xml and run 'mvn clean' | |
| while IFS= read -r -d '' file; do | |
| (cd "$(dirname "$file")" && mvn clean) || true | |
| maven_count=$((maven_count + 1)) | |
| done < <(find . -type f -name "pom.xml" -print0) | |
| # Recursively find directories containing build.gradle or build.gradle.kts and run './gradlew clean' | |
| while IFS= read -r -d '' file; do | |
| (cd "$(dirname "$file")" && ./gradlew clean) || true | |
| gradle_count=$((gradle_count + 1)) | |
| done < <(find . -type f \( -name "build.gradle" -o -name "build.gradle.kts" \) -print0) | |
| echo "---------------------------------" | |
| echo "Summary:" | |
| echo "Maven projects cleaned: $maven_count" | |
| echo "Gradle projects cleaned: $gradle_count" | |
| echo "---------------------------------" | |
| if [ $((maven_count + gradle_count)) -eq 0 ]; then | |
| echo "No Maven or Gradle projects found." | |
| else | |
| echo "Total projects cleaned: $((maven_count + gradle_count))" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment