Skip to content

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.

  • Gradle Gradle plugin


    Formats the lines you changed with formatDiff and keeps IntelliJ IDEA on the same formatter version as the build.

  • Spotless


    Works with Gradle through our plugin. Maven waits for a pull request in Spotless.

  • Apache Maven Maven plugin


    Formats the sources in every build, or fails the build in CI when they are not formatted.

  • Command line


    A native binary for Linux, macOS and Windows, or a runnable jar anywhere else. Formats files in place or checks them.

  • IntelliJ IDEA IntelliJ IDEA


    Makes Reformat Code run open-java-format instead of the IDE's own Java formatter.

  • Eclipse IDE Eclipse


    Adds open-java-format as a formatter implementation for the Java editor.

  • GitHub Actions GitHub Action and pre-commit


    Fails a pull request, or stops a commit, when a Java file is not formatted.