From 6300aa8af7fc5f7458acc7b763380632cefb7f80 Mon Sep 17 00:00:00 2001 From: Alex Abashev Date: Sat, 7 Nov 2026 11:18:15 +0300 Subject: [PATCH] Say the Gradle plugin works with the configuration cache formatDiff and the Spotless step failed with Gradle's configuration cache on (openjavaformat/open-java-format#193). The Gradle page now says the plugin's tasks work with it, which versions up to 21.0.1 do not, and that Gradle's own idea task turns it off. To merge with the release that has the fix: until then the page would promise what the published plugin does not do. --- docs/get-started/gradle.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/get-started/gradle.md b/docs/get-started/gradle.md index 831c31e..12f20e5 100644 --- a/docs/get-started/gradle.md +++ b/docs/get-started/gradle.md @@ -115,6 +115,22 @@ is resolved by the root project, so the root project needs the repository too. } ``` +## Configuration cache + +The plugin works with Gradle's configuration cache: `formatDiff`, the [Spotless](spotless.md) step +and the IntelliJ IDEA tasks below run from a cached configuration, and the next build reuses it. +Turn the cache on as for any build: + +``` properties title="gradle.properties" +org.gradle.configuration-cache=true +``` + +Up to 21.0.1, `formatDiff` and the Spotless step fail with the cache on +([#193](https://github.com/openjavaformat/open-java-format/issues/193)). + +Gradle's own `idea` task does not support the cache, and Gradle turns it off for a build that runs +the task. + ## IntelliJ IDEA When the project is opened in IntelliJ IDEA, the plugin writes the formatter settings into `.idea`,