File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
docs/processes/release/tasks Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,37 @@ the UTF-8 signature byte sequence ("BOM").~~
126126
127127# # Clean up import statements
128128
129+ # ## From command line
130+
131+ This can be done from command line using the
132+ [Google Java Format](https://github.com/google/google-java-format) tool.
133+
134+ ** WARNING:** requires JDK 17 or newer (December 2024)
135+
136+ Download the latest Google Java Format from Maven Central:
137+ ` ` ` sh
138+ mvn dependency:copy -Dartifact= com.google.googlejavaformat:google-java-format:LATEST:jar:all-deps \
139+ -DoutputDirectory= /tmp \
140+ -Dmdep.stripVersion= true \
141+ -q -nt p
142+ ` ` `
143+
144+ Cleanup all Java files (only imports, nothing else):
145+ ` ` ` sh
146+ find . -t ype f -n ame ' *.java' | xargs java -jar /tmp/google-java-format-all-deps.jar -i --aosp --fix-imports-only --skip-sorting-imports
147+ ` ` `
148+
149+ Remove the Google Java Format artifact from the temporary folder:
150+ ` ` ` sh
151+ rm /tmp/google-java-format-all-deps.jar
152+ ` ` `
153+
154+ You can (of course) download it from
155+ [GitHub Releases](https://github.com/google/google-java-format/releases). \
156+ Or save it in a personal tools folder and keep it around.
157+
158+ # ## From Eclipse
159+
129160The Eclipse IDE provides a feature which allow you to organize import statements
130161for multiple files. Right click on projects/source folders/files, you can select
131162\[ Source\] - \[ Organize Imports\] which resolve all wildcard imports and sort
You can’t perform that action at this time.
0 commit comments