Skip to main content
Version: 2.12 (deprecated)

google-java-format


Google Java Format (https://github.com/google/google-java-format)

Backend: pants.backend.experimental.java.lint.google_java_format

Config section: [google-java-format]

Basic options

aosp

--[no-]google-java-format-aosp
PANTS_GOOGLE_JAVA_FORMAT_AOSP
pants.toml
[google-java-format]
aosp = <bool>
default: False

Use AOSP style instead of Google Style (4-space indentation). ("AOSP" is the Android Open Source Project.)

skip

--[no-]google-java-format-skip
PANTS_GOOGLE_JAVA_FORMAT_SKIP
pants.toml
[google-java-format]
skip = <bool>
default: False

Don't use Google Java Format when running /home/josh/work/scie-pants/dist/pants fmt and /home/josh/work/scie-pants/dist/pants lint.

Advanced options

artifacts

--google-java-format-artifacts="['<str>', '<str>', ...]"
PANTS_GOOGLE_JAVA_FORMAT_ARTIFACTS
pants.toml
[google-java-format]
artifacts = [
'<str>',
'<str>',
...,
]
default:
[
  "com.google.googlejavaformat:google-java-format:{version}"
]

Artifact requirements for this tool using specified as either the address of a jvm_artifact target or, alternatively, as a colon-separated Maven coordinates (e.g., group:name:version). For Maven coordinates, the string {version} version will be substituted with the value of the [google-java-format].version option.

lockfile

--google-java-format-lockfile=<str>
PANTS_GOOGLE_JAVA_FORMAT_LOCKFILE
pants.toml
[google-java-format]
lockfile = <str>
default: <default>

Path to a lockfile used for installing the tool.

Set to the string <default> to use a lockfile provided by Pants, so long as you have not changed the --version option. See https://github.com/pantsbuild/pants/blob/release_2.12.1/src/python/pants/backend/java/lint/google_java_format/google_java_format.default.lockfile.txt for the default lockfile contents.

To use a custom lockfile, set this option to a file path relative to the build root, then run /home/josh/work/scie-pants/dist/pants jvm-generate-lockfiles --resolve=google-java-format.

version

--google-java-format-version=<str>
PANTS_GOOGLE_JAVA_FORMAT_VERSION
pants.toml
[google-java-format]
version = <str>
default: 1.13.0

Version string for the tool. This is available for substitution in the [google-java-format].artifacts option by including the string {version}.

Deprecated options

None

None