🌐
GitHub
github.com › google › google-java-format
GitHub - google/google-java-format: Reformats Java source code to comply with Google Java Style. · GitHub
August 14, 2026 - Option --help will print full usage ... as --aosp, --fix-imports-only, --skip-sorting-imports, --skip-removing-unused-import, --skip-reflowing-long-strings, --skip-javadoc-formatting, or the --dry-run and --set-exit-if-changed. Using @<filename> reads options and filenames from a file, instead of arguments. To reformat changed lines in a specific patch, use google-java-form...
Author: google
Discussions

google-java-format import sorting for AOSP
google-java-format supports the --aosp flag, which formats 4 spaces (instead of the default 2 spaces). AOSP style guide recommends a AOSP specific way to sort imports. If the team open to contribut... More on github.com
🌐 github.com
4
November 12, 2018
How to get similar google java formatting in intellij and with maven - Stack Overflow
I'd like to have the google java ... the google-java-format plugin for IntelliJ or something else if that's not the best way to do...) and be able to check with maven that formatting is OK (in a GitHub workflow for example). I tried the spotless plugin. Unfortunately for the moment, the results are completely different if I use one or the other (imports order, parameters in methods, ...). I use the AOSP format to ... More on stackoverflow.com
🌐 stackoverflow.com
Maven: Inconsistent formatting of Java (google AOSP style) with plugin and google-java-format.jar
Summary I have google-java-format intellij plugin installed and configured to use AOSP style, and spotless maven plugin that is configured with AOSP as well. The versions of both the intellij plugi... More on github.com
🌐 github.com
2
March 19, 2024
code formatting - Google IntelliJ java style: changing 2-space indentation to 4-space indentation - Stack Overflow
When I format the code, my java code gets indented by 2 spaces. How do i change the google java formatter plugin setting to change to 4 spaces? ... I was able to change to 4-space indentations by selecting the Android Open Source Project (AOSP) style in the google-java-format plugin settings: More on stackoverflow.com
🌐 stackoverflow.com
🌐
GitLab
gitlab.com › aosp mirror › platform › external › google-java-format
AOSP mirror / platform / external / google-java-format · GitLab
google-java-format · Project information · README · Apache License 2.0 · CONTRIBUTING · Created on · October 13, 2023 · Loading
🌐
GitHub
github.com › google › google-java-format › issues › 319
google-java-format import sorting for AOSP · Issue #319 · google/google-java-format
November 12, 2018 - google-java-format supports the --aosp flag, which formats 4 spaces (instead of the default 2 spaces). AOSP style guide recommends a AOSP specific way to sort imports. If the team open to contribution to extend ImportOrderer to support A...
Author: google
🌐
GitHub
github.com › google › google-java-format › blob › master › core › src › main › java › com › google › googlejavaformat › java › JavaFormatterOptions.java
google-java-format/core/src/main/java/com/google/googlejavaformat/java/JavaFormatterOptions.java at master · google/google-java-format
public record JavaFormatterOptions(boolean formatJavadoc, boolean reorderModifiers, Style style) { public JavaFormatterOptions { requireNonNull(style, "style"); } · public enum Style { /** The default Google Java Style configuration. */ GOOGLE(1), · /** The AOSP-compliant configuration.
Author: google
🌐
GitHub
github.com › google › google-java-format › pull › 251 › files › 002651f0f5611085171a35e7699f625f9b7fdc90
This adds an AOSP formatter to the Eclipse plugin. by bryanschofield · Pull Request #251 · google/google-java-format
The google-java-format acts just the same. A new aosp-java-format enables AOSP options. Internally this is achieved by giving the SnippetFormatter the ability to accept JavaFormatterOptions.
Author: google
🌐
Stack Overflow
stackoverflow.com › questions › 76716652 › how-to-get-similar-google-java-formatting-in-intellij-and-with-maven
How to get similar google java formatting in intellij and with maven - Stack Overflow
Copy <plugin> <groupId>com.diffplug.spotless</groupId> <artifactId>spotless-maven-plugin</artifactId> <version>2.30.0</version> <executions> <execution> <goals> <goal>check</goal> </goals> </execution> </executions> <configuration> <java> <googleJavaFormat> <version>1.7</version> <style>AOSP</style> </googleJavaFormat> <removeUnusedImports /> <licenseHeader> <file>../license-header</file> </licenseHeader> </java> </configuration> </plugin> Am I missing something? Aren't they supposed to work with google format (which should be the same...)?
🌐
Pantsbuild
pantsbuild.org › subsystems › google-java-format
google-java-format | Pantsbuild
Use AOSP style instead of Google Style (4-space indentation). ("AOSP" is the Android Open Source Project.) --[no-]google-java-format-skip PANTS_GOOGLE_JAVA_FORMAT_SKIP
🌐
Android Open Source Project
source.android.com › docs › setup › contribute › code-style
AOSP Java code style for contributors | Android Open Source Project
March 13, 2025 - Every file should have a copyright statement at the top, followed by package and import statements (each block separated by a blank line), and finally the class or interface declaration. In the Javadoc comments, describe what the class or interface does.
Find elsewhere
🌐
GitHub
github.com › google › google-java-format › actions › runs › 18785970444 › job › 53604192391
Add support for AOSP formatting in the Eclipse plugin · google/google-java-format@39b6212
Reformats Java source code to comply with Google Java Style. - Add support for AOSP formatting in the Eclipse plugin · google/google-java-format@39b6212
Author: google
🌐
tr ouwens
jqno.nl › post › 2024 › 08 › 24 › why-are-there-no-decent-code-formatters-for-java
Why are there no decent code formatters for Java? - tr ouwens
August 24, 2024 - Thankfully, the one configuration option that they have, allows you to use 4 spaces instead. This option is called AOSP for Android Open Source Project because when Google acquired it, Android had been using 4 spaces like any sane Java shop.
🌐
GitHub
github.com › diffplug › spotless › issues › 2071
Maven: Inconsistent formatting of Java (google AOSP style) with plugin and google-java-format.jar · Issue #2071 · diffplug/spotless
March 19, 2024 - I have google-java-format intellij plugin installed and configured to use AOSP style, and spotless maven plugin that is configured with AOSP as well. The versions of both the intellij plugin and the google-java-format version in spotless are the same, so it's unlikely this is a version discrepancy.
Author: diffplug
🌐
GitHub
github.com › diffplug › spotless › pull › 193 › files
Support for google-java-format's style option (AOSP style) by ohorn · Pull Request #193 · diffplug/spotless
The google-java-format CLI exposes an option --aosp to switch from the default Google Java Style to AOSP-compliant style (4-space indentation). Such a configuration option is missing from Spotless.
Author: diffplug
🌐
GitHub
github.com › google › google-java-format › issues › 179
google-java-format Eclipse plugin does not provide AOSP Style option as google-java-format IntelliJ plugin · Issue #179 · google/google-java-format
August 21, 2017 - The google-java-format Eclipse plugin works in Eclipse IDE for Java Developers Version: Oxygen Release (4.7.0) Build id: 20170620-1800 But it does not provide AOSP Style option. Is this intentional design? Most members of my team like AO...
Author: google
🌐
GitHub
github.com › google › google-java-format › wiki › FAQ
FAQ · google/google-java-format Wiki · GitHub
Most options are used only to switch entire behaviors on or off. (The primary exception is --aosp which allows the tool to be used with AOSP code, but inside Google this option is never surfaced through all the various integrations.)
Author: google
🌐
GitHub
github.com › google › google-java-format › blob › master › scripts › google-java-format-diff.py
google-java-format/scripts/google-java-format-diff.py at master · google/google-java-format
binary = which('google-java-format') or '/usr/bin/google-java-format' base_command = [binary] · if args.i: base_command.append('-i') if args.aosp: base_command.append('--aosp') if args.skip_sorting_imports: base_command.append('--skip-sorting-imports') if args.skip_removing_unused_imports: base_command.append('--skip-removing-unused-imports') if args.skip_javadoc_formatting: base_command.append('--skip-javadoc-formatting') ·
Author: google