Get started¶
open-java-format runs in the build, in the editor, on the command line and in CI. Every route uses the same formatter, so they all produce the same files. Set up the ones your project needs.
Requirements
The current version is 21.0.2. Everything except the native binaries needs Java 21 or later, and the Gradle plugin needs Gradle 9. The Maven plugin has version numbers of its own; the current one is 2.27.0.2.
-
Formats the lines you changed with
formatDiffand keeps IntelliJ IDEA on the same formatter version as the build. -
Works with Gradle through our plugin. Maven waits for a pull request in Spotless.
-
Formats the sources in every build, or fails the build in CI when they are not formatted.
-
A native binary for Linux, macOS and Windows, or a runnable jar anywhere else. Formats files in place or checks them.
-
Makes Reformat Code run open-java-format instead of the IDE's own Java formatter.
-
Adds open-java-format as a formatter implementation for the Java editor.
-
Fails a pull request, or stops a commit, when a Java file is not formatted.