spotless
spotless copied to clipboard
Maven Groovy importOrder prevents greclipse from checking and applying
- [x] Maven Groovy
importOrder
preventsgreclipse
from checking and applying - [x] maven version: 3.8.1
- [x] spotless version: 2.12.2
- [x] operating system and version: macOS Catalina v10.15.7
- [x] copy-paste your full Spotless configuration block(s):
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.12.2</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<java>
<googleJavaFormat />
</java>
<groovy>
<importOrder />
<greclipse />
</groovy>
</configuration>
</plugin>
Did you try switching the order? <greclipse />
then <importOrder />
?
@nedtwigg yes, it only worked after removing <importOrder />
I'm using gradle, and am encountering quite a few of the following which appear only when using importOrder()
Skipping '/path/to/foo.groovy' because it does not converge However with gradle, the
greclipse()
reformatting still occurs.
Are you seeing similar warnings caused by <importOrder />
? If yes, and you remove those problematic files, does the problem with <greclipse />
disappear?
There were no warnings displayed. This issue didn't seem limited to a few files, but to all of them.
We only use Groovy for our unit tests with Spock, where we use a wildcard import for Spock. Perhaps it sees the wildcard and skips the formatting of the file.
If you havent already, perhaps try with a basic build.gradle
to see if the gradle plugin is emitting warnings caused by importOrder
. That will help confirm it is a problem specific to the Maven plugin, and allow confirmation that it is all files or a subset.
plugins {
id 'com.diffplug.spotless' version '5.14.2'
}
apply plugin: 'groovy'
repositories {
mavenCentral()
}
sourceSets {
main {
groovy {
srcDir '<your src>'
}
}
}
spotless {
groovy {
greclipse()
importOrder()
}
}
Upon further playing around, I believe this also affects the gradle plugin. It looks like it stops processing greclipse()
on the first time it encounters a problem in importOrder()
. We are also using wildcard imports.