Palantir Java Format does not work with latest 7.0.0 spotless plugin

Open
#2,385 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
java
Domain
build-system

Research direction

Start by reproducing the failure with Gradle 8.11.1, the latest Spotless release, and the shown palantirJavaFormat() configuration. Trace the ':spotlessApply' and ':spotlessJavaApply' task creation errors around FormatterStep.createLazy; done means the configuration creates and runs successfully, but no public reproducer is provided.

Written by the indexing model from the issue text.

Description

bug-unconfirmed

Summary of Problem:

Encountered a NoSuchMethodError when trying to use the palantirJavaFormat() method in the Spotless configuration. The error suggests a version mismatch or compatibility issue between the Spotless plugin and the Palantir Java Format library.

Gradle Version:

8.11.1

Spotless Version:

Using latest.release in the build script, which resolves to the latest stable version at the time of the build.

Operating System and Version: macOS Monterey 12.6

Spotless Configuration Block:

groovy
spotless {
    java {
        palantirJavaFormat()
        removeUnusedImports()
        target project.fileTree(project.projectDir) {
            include '**/*.java'
            excludes.each {
                exclude it
            }
        }
    }
}

Link to Public Git Repo:

Unfortunately, I do not have a public repository that reproduces the problem at this time.

Console Errors:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':spotlessApply'.
> Could not create task ':spotlessJavaApply'.
   > Could not create task ':spotlessJava'.
      > 'com.diffplug.spotless.FormatterStep com.diffplug.spotless.FormatterStep.createLazy(java.lang.String, com.diffplug.spotless.ThrowingEx$Supplier, com.diffplug.spotless.ThrowingEx$Function)'
Dominant language
Java
Stars
5.7k
Forks
560
Avg merge
1d 13h
Merged PRs (30d)
43

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from diffplug/spotless

All issues in diffplug/spotless

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.