Skip to content

Upgrade com.diffplug.spotless 6.2.1 -> 7.2.1 (google-java-format pinned to 1.13.0) - #202

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1785171619-upgrade-spotless
Open

Upgrade com.diffplug.spotless 6.2.1 -> 7.2.1 (google-java-format pinned to 1.13.0)#202
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1785171619-upgrade-spotless

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Upgrades only the Spotless Gradle plugin. The formatter itself is pinned to the version Spotless 6.2.1 resolves today, so formatting output is byte-identical and no .java file changes.

 plugins {
-    id "com.diffplug.spotless" version "6.2.1"
+    id "com.diffplug.spotless" version "7.2.1"
 }
 spotless { java {
-        googleJavaFormat()
+        googleJavaFormat('1.13.0')
 } }

Diff is build.gradle only — 2 lines.

Why 7.2.1 and not 6.25.0

The assignment suggested 6.25.0 on the assumption that Spotless 7.x needs Gradle 8+. Verified upstream and empirically, that is not the case:

  • Spotless 7.2.1 (released 2025-07-21) plugin-gradle/README.md: "Spotless requires JRE 11+ and Gradle 6.1.1 or newer."
  • Spotless 8.0.0 is the version that raises the floor: "BREAKING Bump the required Gradle to 7.3 and required Java to 17" — Java 17 is out of bounds for this repo (Java 11 ceiling), so 7.2.1 is the newest usable release.
  • 7.2.1 was exercised here on Gradle 7.4 + JDK 11 with spotlessApply, spotlessCheck and the full gate — all green.

Why the formatter is pinned

Spotless 6.2.1's default google-java-format is 1.13.0 (confirmed empirically: javap -c on the cached spotless-lib-2.22.1.jar GoogleJavaFormatStep shows the constant 1.13.0, and the Gradle cache contains only google-java-format/1.13.0). Spotless 7.2.1's default would be 1.24.0, which reformats the whole source tree. Pinning googleJavaFormat('1.13.0') keeps the output identical while parallel upgrade PRs are open against this repo. A follow-up PR can drop the pin and adopt the newer google-java-format once those have merged (note: gjf 1.25+ requires Java 17, so the follow-up is bounded by the Java 11 ceiling too).

API migration

No source changes needed. The plugin is build-time only; the spotless { java { ... } } DSL used here (target, googleJavaFormat) is unchanged in 7.x, and pinning the formatter version means the format itself did not move.

Version resolution evidence

$ ./gradlew buildEnvironment | grep spotless
\--- com.diffplug.spotless:com.diffplug.spotless.gradle.plugin:7.2.1
     \--- com.diffplug.spotless:spotless-plugin-gradle:7.2.1
          +--- com.diffplug.spotless:spotless-lib:3.3.1
          \--- com.diffplug.spotless:spotless-lib-extra:3.3.1

(The plugin resolves on the buildscript classpath, not runtimeClasspath/testRuntimeClasspath, so buildEnvironment is the applicable insight command; the Spring Boot BOM does not manage it.)

Source-clean check:

$ JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 ./gradlew spotlessApply
BUILD SUCCESSFUL
$ git status --short
 M build.gradle          # no .java files modified

Negative control — spotlessCheck still enforces under 7.2.1 (appended a deliberately misformatted class to Util.java, ran the check, reverted):

$ ./gradlew spotlessCheck
BUILD FAILED

Gate

$ JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 ./gradlew clean test spotlessCheck -x jacocoTestCoverageVerification
BUILD SUCCESSFUL in 17s
tests 68  failures 0  errors 0  skipped 0

Baseline recorded on untouched main (commit 3037fa5) with the same command: BUILD SUCCESSFUL, tests 68, failures 0, errors 0, skipped 0. Equal test count, zero new failures.

Pre-existing on base, not addressed here

  • jacocoTestCoverageVerification fails on main at ~0.33 instruction coverage against the 0.80 rule in build.gradle. CI excludes it (./gradlew clean test -x jacocoTestCoverageVerification) and so does the gate above. Threshold untouched, no tests added to game it.
  • The spotlessJava "Execution optimizations have been disabled … uses this output of task ':compileJava' without declaring an explicit or implicit dependency" warnings are present on main before this change as well (a project.fileTree(rootDir) target that overlaps build/); unchanged by the upgrade and out of scope.
  • Selenium E2E tests (src/test/java/io/spring/selenium) run under the separate seleniumTest TestNG task and are not part of the gate.

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/84fae1c4ce184c728f3a79f548562af9
Requested by: @mbatchelor81

@mbatchelor81 mbatchelor81 self-assigned this Jul 27, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant