I'm using google-java-format to format Java code according to Google Java Style. However, I only find documentation and examples showing how to format one file using the CLI.
Is there a built-in way to format an entire Java project directly using the CLI (without looping using a shell script or something else)?
The answer above suggests using xargs
, so here's the command that I used:
find my_java_project/ -name "*.java" -type f -print | xargs java -jar google-java-format-1.18.1-all-deps.jar --replace
...where my current working directory contains my Java project (in the my_java_project
folder) and the Google Java Format JAR.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With