palantir-java-format
palantir-java-format copied to clipboard
Unable to load class 'com.diffplug.spotless.FormatterStep'.
Followed these instructions in the README and when I sync Gradle changes in IntelliJ IDEA I get the following error:
Build file 'build.gradle' line: 42
A problem occurred evaluating root project.
> Failed to apply plugin class 'com.palantir.javaformat.gradle.PalantirJavaFormatSpotlessPlugin'.
> Could not create an instance of type com.palantir.javaformat.gradle.SpotlessInterop.
> Could not generate a decorated class for type SpotlessInterop.
> com/diffplug/spotless/FormatterStep
Line 42 is the following:
apply plugin: 'com.palantir.java-format'
I am getting the same error, regardless of whether the plugin is installed or not.
Using Gradle 8.14.3.
Any idea what I might be doing wrong?
I was able to work around this by also including the spotless plugin.
Here's a simplified version of my multi module build.gradle:
plugins {
id 'java'
id 'java-library'
id 'java-test-fixtures'
id 'io.freefair.lombok' version '6.5.0.3'
// Note that I didn't particularly mind whether we had spotless or not, but it's an implicit
// dependency for the java-format plugin (it fails without spotless plugin being present, even
// if it isn't applied
id 'com.diffplug.spotless' version '7.2.1'
id 'com.palantir.java-format' version '2.73.0'
}
repositories {
mavenCentral()
}
With this in place I was able to successfully run format and formatDiff