· · ─ ·✶· ─ · ·
Go into .git/hooks/pre-commit and add the below,
#!/bin/sh
mvn spotless:apply || exit 1
mvn spotbugs:check || exit 1
mvn pmd:check || exit 1
echo "All checks passed. Proceeding with commit."Done. Now when we commit it will run, spotless, spotbugs and pmd.
· · ─ ·✶· ─ · ·