A modern, lambda-friendly, 120 character Java formatter.
Java
3
2,145 commits
updated Sep 23, 2026
A modern, lambda-friendly, 120-character Java formatter — built in the open.
Documentation: openjavaformat.dev
open-java-format is released and developed independently. It began as a community fork of palantir-java-format, which is itself a fork of google-java-format, and every artifact is now built and published from this repository.
| Where | What |
|---|---|
| Maven Central | dev.openjavaformat:open-java-format, with -spi, -native and -jdk-bootstrap |
| Gradle Plugin Portal | dev.openjavaformat.java-format |
| JetBrains Marketplace | the IntelliJ IDEA plugin |
| GitHub Releases | native binaries, a runnable jar, the Gradle, IntelliJ and Eclipse plugins, every file signed |
Why the project exists is in the manifesto.
Each page is short and every command on it was run against the published artifacts.
Lines are up to 120 characters wide. A lambda stays on the line where it starts, and a long call chain breaks into one call per line.
google-java-format:
private static void configureResolvedVersionsWithVersionMapping(Project project) {
project.getPluginManager()
.withPlugin(
"maven-publish",
plugin -> {
project.getExtensions()
.getByType(PublishingExtension.class)
.getPublications()
.withType(MavenPublication.class)
.configureEach(
publication ->
publication.versionMapping(
mapping -> {
mapping.allVariants(
VariantVersionMappingStrategy
::fromResolutionResult);
}));
});
}
open-java-format:
private static void configureResolvedVersionsWithVersionMapping(Project project) {
project.getPluginManager().withPlugin("maven-publish", plugin -> {
project.getExtensions()
.getByType(PublishingExtension.class)
.getPublications()
.withType(MavenPublication.class)
.configureEach(publication -> publication.versionMapping(mapping -> {
mapping.allVariants(VariantVersionMappingStrategy::fromResolutionResult);
}));
});
}
com.palantir.javaformat.* stays for the whole 2.x line, so your code
and the SPI keep working.Changes to the formatter's output wait for 3.0.
| palantir-java-format | open-java-format | |
|---|---|---|
| Maven group | com.palantir.javaformat | dev.openjavaformat |
| Core | palantir-java-format | open-java-format |
| SPI | palantir-java-format-spi | open-java-format-spi |
| Native image | palantir-java-format-native | open-java-format-native |
| JDK bootstrap | palantir-java-format-jdk-bootstrap | open-java-format-jdk-bootstrap |
| Gradle plugin artifact | gradle-palantir-java-format | gradle-open-java-format |
| Gradle plugin IDs | com.palantir.java-format, -idea, -spotless, -provider | dev.openjavaformat.java-format, -idea, -spotless, -provider |
| IntelliJ plugin ID | palantir-java-format | open-java-format |
| Eclipse plugin bundle | palantir-java-format-eclipse-plugin | open-java-format-eclipse-plugin |
| CLI style flag | --palantir, -palantir | --ojf, -ojf |
| Formatter style | PALANTIR | OJF |
| Native formatter Gradle property | palantir.native.formatter | openjavaformat.native.formatter |
| Java packages | com.palantir.javaformat.* | unchanged in 2.x |
| Version numbers | 2.98.0 | 2.98.0.1 |
mise pins the tooling: mise.toml installs Temurin 21 and
act.
mise trust && mise install
./gradlew test # what the CI build job runs
-PjavaRuntime=25 runs the same tests on JDK 25, as CI's jdk jobs do for 25, 26 and 27. The code
is compiled for Java 21 either way. Gradle has to find that JDK: installed with mise, or named with
-Porg.gradle.java.installations.paths=/path/to/jdk.
Nothing inside the build downloads a JDK. gradle.properties turns toolchain auto-download off and
reads the installations from JDK21_HOME and GRAALVM_HOME, so a missing JDK is an error you can
read rather than a silent download.
The native image needs a GraalVM 25 behind GRAALVM_HOME. CI installs it with
graalvm/setup-graalvm and builds the image in a job of its own:
./gradlew -PnativeImage=true :open-java-format-native:nativeCompile
GraalVM has to come from outside Gradle: unpacking a JDK that Gradle downloaded itself does not
preserve the symlink GraalVM ships at bin/native-image, and nativeCompile then fails on an empty,
unexecutable file.
The workflows run under act in Docker, so a change to .github/workflows can be checked before it
is pushed:
mise run ci:list # what jobs exist
mise run ci:lint # dry-run every job: resolves images, actions and steps, executes nothing
mise run ci:build # actually run the linux jar+native build job
mise run ci:native # actually run the linux-aarch64 native job
Two caveats:
macos-aarch64 leg has to be checked by building the
native image on a Mac.ubuntu-24.04 container runs as arm64, so the job labelled
linux-x86-64 produces an aarch64 binary locally. Fine for exercising the workflow, not a
substitute for real CI.This project is a fork of palantir-java-format, which is itself a fork of google-java-format. It is distributed under the same Apache 2.0 License, and it keeps every upstream copyright notice — from both projects — permanently.
Neither Palantir Technologies Inc. nor Google LLC endorses, sponsors or is affiliated with this fork. "Palantir" and "Google" are trademarks of their respective owners, and Apache 2.0 §6 grants no rights to them; the rename described in this README exists in part for that reason.
(c) Copyright 2019 Palantir Technologies Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
Original work copyrighted by Google under the same license:
Copyright 2015 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
(top 30 of 98)
Java
97.0%
TypeScript
2.2%
A modern, lambda-friendly, 120 character Java formatter.
Java
3
2,145 commits
updated Sep 23, 2026
A modern, lambda-friendly, 120-character Java formatter — built in the open.
Documentation: openjavaformat.dev
open-java-format is released and developed independently. It began as a community fork of palantir-java-format, which is itself a fork of google-java-format, and every artifact is now built and published from this repository.
| Where | What |
|---|---|
| Maven Central | dev.openjavaformat:open-java-format, with -spi, -native and -jdk-bootstrap |
| Gradle Plugin Portal | dev.openjavaformat.java-format |
| JetBrains Marketplace | the IntelliJ IDEA plugin |
| GitHub Releases | native binaries, a runnable jar, the Gradle, IntelliJ and Eclipse plugins, every file signed |
Why the project exists is in the manifesto.
Each page is short and every command on it was run against the published artifacts.
Lines are up to 120 characters wide. A lambda stays on the line where it starts, and a long call chain breaks into one call per line.
google-java-format:
private static void configureResolvedVersionsWithVersionMapping(Project project) {
project.getPluginManager()
.withPlugin(
"maven-publish",
plugin -> {
project.getExtensions()
.getByType(PublishingExtension.class)
.getPublications()
.withType(MavenPublication.class)
.configureEach(
publication ->
publication.versionMapping(
mapping -> {
mapping.allVariants(
VariantVersionMappingStrategy
::fromResolutionResult);
}));
});
}
open-java-format:
private static void configureResolvedVersionsWithVersionMapping(Project project) {
project.getPluginManager().withPlugin("maven-publish", plugin -> {
project.getExtensions()
.getByType(PublishingExtension.class)
.getPublications()
.withType(MavenPublication.class)
.configureEach(publication -> publication.versionMapping(mapping -> {
mapping.allVariants(VariantVersionMappingStrategy::fromResolutionResult);
}));
});
}
com.palantir.javaformat.* stays for the whole 2.x line, so your code
and the SPI keep working.Changes to the formatter's output wait for 3.0.
| palantir-java-format | open-java-format | |
|---|---|---|
| Maven group | com.palantir.javaformat | dev.openjavaformat |
| Core | palantir-java-format | open-java-format |
| SPI | palantir-java-format-spi | open-java-format-spi |
| Native image | palantir-java-format-native | open-java-format-native |
| JDK bootstrap | palantir-java-format-jdk-bootstrap | open-java-format-jdk-bootstrap |
| Gradle plugin artifact | gradle-palantir-java-format | gradle-open-java-format |
| Gradle plugin IDs | com.palantir.java-format, -idea, -spotless, -provider | dev.openjavaformat.java-format, -idea, -spotless, -provider |
| IntelliJ plugin ID | palantir-java-format | open-java-format |
| Eclipse plugin bundle | palantir-java-format-eclipse-plugin | open-java-format-eclipse-plugin |
| CLI style flag | --palantir, -palantir | --ojf, -ojf |
| Formatter style | PALANTIR | OJF |
| Native formatter Gradle property | palantir.native.formatter | openjavaformat.native.formatter |
| Java packages | com.palantir.javaformat.* | unchanged in 2.x |
| Version numbers | 2.98.0 | 2.98.0.1 |
mise pins the tooling: mise.toml installs Temurin 21 and
act.
mise trust && mise install
./gradlew test # what the CI build job runs
-PjavaRuntime=25 runs the same tests on JDK 25, as CI's jdk jobs do for 25, 26 and 27. The code
is compiled for Java 21 either way. Gradle has to find that JDK: installed with mise, or named with
-Porg.gradle.java.installations.paths=/path/to/jdk.
Nothing inside the build downloads a JDK. gradle.properties turns toolchain auto-download off and
reads the installations from JDK21_HOME and GRAALVM_HOME, so a missing JDK is an error you can
read rather than a silent download.
The native image needs a GraalVM 25 behind GRAALVM_HOME. CI installs it with
graalvm/setup-graalvm and builds the image in a job of its own:
./gradlew -PnativeImage=true :open-java-format-native:nativeCompile
GraalVM has to come from outside Gradle: unpacking a JDK that Gradle downloaded itself does not
preserve the symlink GraalVM ships at bin/native-image, and nativeCompile then fails on an empty,
unexecutable file.
The workflows run under act in Docker, so a change to .github/workflows can be checked before it
is pushed:
mise run ci:list # what jobs exist
mise run ci:lint # dry-run every job: resolves images, actions and steps, executes nothing
mise run ci:build # actually run the linux jar+native build job
mise run ci:native # actually run the linux-aarch64 native job
Two caveats:
macos-aarch64 leg has to be checked by building the
native image on a Mac.ubuntu-24.04 container runs as arm64, so the job labelled
linux-x86-64 produces an aarch64 binary locally. Fine for exercising the workflow, not a
substitute for real CI.This project is a fork of palantir-java-format, which is itself a fork of google-java-format. It is distributed under the same Apache 2.0 License, and it keeps every upstream copyright notice — from both projects — permanently.
Neither Palantir Technologies Inc. nor Google LLC endorses, sponsors or is affiliated with this fork. "Palantir" and "Google" are trademarks of their respective owners, and Apache 2.0 §6 grants no rights to them; the rename described in this README exists in part for that reason.
(c) Copyright 2019 Palantir Technologies Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
Original work copyrighted by Google under the same license:
Copyright 2015 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
(top 30 of 98)
Java
97.0%
TypeScript
2.2%