Skip to content

Add Eclipse JDT embedded lockfiles, upgrade formatter version to 4.40#3000

Open
scordio wants to merge 2 commits into
diffplug:mainfrom
scordio:gh-1996-eclipse-jdt-lockfiles
Open

Add Eclipse JDT embedded lockfiles, upgrade formatter version to 4.40#3000
scordio wants to merge 2 commits into
diffplug:mainfrom
scordio:gh-1996-eclipse-jdt-lockfiles

Conversation

@scordio

@scordio scordio commented Jul 25, 2026

Copy link
Copy Markdown

This PR introduces lockfiles for the Eclipse JDT formatter, falling back to today's behavior via P2 resolution if an embedded lockfile for the selected version doesn't exist.

In addition, the default JDT version is now upgraded to the latest available (4.40), and embedded lockfiles have been added for versions 4.40, 4.39, 4.11, and 4.9. The rationale for covering the last two is only because those versions appeared in test code, but please let me know what the proper version range should be, and I'll happily adjust this PR and/or introduce missing lockfiles.

To support maintenance and future lockfile generation, I added a new EclipseJdtLockfileMetadataTool among the test classes. This class has two main entry points that can be manually invoked to either verify or update the existing lockfiles by resolving org.eclipse.jdt.core versions directly from the metadata available at https://download.eclipse.org/eclipse/updates/. If you think there is a better approach to achieve the same, please let me know, and I'd be happy to update my changes.

Disclaimer: this is my first Spotless contribution and I wasn't familiar with its codebase and internal architecture. For this reason, I used GitHub Copilot to navigate through it, brainstorm on a possible solution, and implement the self-contained EclipseJdtLockfileMetadataTool class to make lockfile maintenance easier. Nevertheless, I went through and updated pretty much everything that Copilot generated.


Please DO NOT FORCE PUSH. Don't worry about messy history, it's easier to do code review if we can tell what happened after the review, and force pushing breaks that.

Please make sure that your PR allows edits from maintainers. Sometimes it's faster for us to just fix something than it is to describe how to fix it.

Allow edits from maintainers

After creating the PR, please add a commit that adds a bullet-point under the [Unreleased] section of CHANGES.md, plugin-gradle/CHANGES.md, and plugin-maven/CHANGES.md which includes:

  • a summary of the change
  • either
    • a link to the issue you are resolving (for small changes)
    • a link to the PR you just created (for big changes likely to have discussion)

If your change only affects a build plugin, and not the lib, then you only need to update the plugin-foo/CHANGES.md for that plugin.

If your change affects lib in an end-user-visible way (fixing a bug, updating a version) then you need to update CHANGES.md for both the lib and all build plugins. Users of a build plugin shouldn't have to refer to lib to see changes that affect them.

This makes it easier for the maintainers to quickly release your changes :)

@scordio

scordio commented Jul 25, 2026

Copy link
Copy Markdown
Author

Before creating a pull request, you might want to format (yes, spotless is formatted by spotless) the code and check for possible bugs

./gradlew spotlessApply
./gradlew spotbugsMain

I tried that locally, but it seems I have some cache configuration errors.

Logs
% ./gradlew spotlessApply
Parallel Configuration Cache is an incubating feature.
Calculating task graph as configuration cache cannot be reused because file 'gradle/spotless.gradle' has changed.
Type-safe project accessors is an incubating feature.

6 problems were found storing the configuration cache.
- Task `:lib-extra:spotlessGroovyGradle` of type `com.diffplug.gradle.spotless.SpotlessTaskImpl`: error writing value of type 'com.diffplug.spotless.ConfigurationCacheHackList'
- Task `:lib:spotlessGroovyGradle` of type `com.diffplug.gradle.spotless.SpotlessTaskImpl`: error writing value of type 'com.diffplug.spotless.ConfigurationCacheHackList'
- Task `:plugin-gradle:spotlessGroovyGradle` of type `com.diffplug.gradle.spotless.SpotlessTaskImpl`: error writing value of type 'com.diffplug.spotless.ConfigurationCacheHackList'
- Task `:plugin-maven:spotlessGroovyGradle` of type `com.diffplug.gradle.spotless.SpotlessTaskImpl`: error writing value of type 'com.diffplug.spotless.ConfigurationCacheHackList'
- Task `:spotlessGroovyGradle` of type `com.diffplug.gradle.spotless.SpotlessTaskImpl`: error writing value of type 'com.diffplug.spotless.ConfigurationCacheHackList'
- Task `:testlib:spotlessGroovyGradle` of type `com.diffplug.gradle.spotless.SpotlessTaskImpl`: error writing value of type 'com.diffplug.spotless.ConfigurationCacheHackList'

See the complete report at file:///Users/stefano/Projects/spotless/build/reports/configuration-cache/exlmz05ylu0bpkxw5gri9wjbi/dpcxsijaza6v5jbddk4m3qm4l/configuration-cache-report.html

[Incubating] Problems report is available at: file:///Users/stefano/Projects/spotless/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

* What went wrong:
Error while saving task graph
> Configuration cache state could not be cached: field `stepsInternalEquality` of task `:testlib:spotlessGroovyGradle` of type `com.diffplug.gradle.spotless.SpotlessTaskImpl`: error writing value of type 'com.diffplug.spotless.ConfigurationCacheHackList'
   > java.io.IOException: Failed to provision P2 dependencies
> Configuration cache state could not be cached: field `stepsInternalEquality` of task `:lib-extra:spotlessGroovyGradle` of type `com.diffplug.gradle.spotless.SpotlessTaskImpl`: error writing value of type 'com.diffplug.spotless.ConfigurationCacheHackList'
   > java.io.IOException: Failed to provision P2 dependencies
> Configuration cache state could not be cached: field `stepsInternalEquality` of task `:lib:spotlessGroovyGradle` of type `com.diffplug.gradle.spotless.SpotlessTaskImpl`: error writing value of type 'com.diffplug.spotless.ConfigurationCacheHackList'
   > java.io.IOException: Failed to provision P2 dependencies
> Configuration cache state could not be cached: field `stepsInternalEquality` of task `:plugin-maven:spotlessGroovyGradle` of type `com.diffplug.gradle.spotless.SpotlessTaskImpl`: error writing value of type 'com.diffplug.spotless.ConfigurationCacheHackList'
   > java.io.IOException: Failed to provision P2 dependencies
> Configuration cache state could not be cached: field `stepsInternalEquality` of task `:plugin-gradle:spotlessGroovyGradle` of type `com.diffplug.gradle.spotless.SpotlessTaskImpl`: error writing value of type 'com.diffplug.spotless.ConfigurationCacheHackList'
   > java.io.IOException: Failed to provision P2 dependencies
> Configuration cache state could not be cached: field `stepsInternalEquality` of task `:spotlessGroovyGradle` of type `com.diffplug.gradle.spotless.SpotlessTaskImpl`: error writing value of type 'com.diffplug.spotless.ConfigurationCacheHackList'
   > java.io.IOException: Failed to provision P2 dependencies

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Get more help at https://help.gradle.org.

BUILD FAILED in 542ms
Configuration cache entry discarded due to serialization error.

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.

Embed p2 lockfiles for Eclipse JDT

1 participant