spotless: Build output directory is not excluded in Windows in Spotless 4.0.x
Summary: Spotless runs on build output files in Windows. The same project passes in Linux and MacOS.
Gradle version: 6.5.1-rc1
Spotless version: 4.0.0 and 4.0.1 Regression when moving from version: 3.30.0
Operating System: Windows Server 2012
Build has standard googleJavaFormat applied.
subprojects {
apply(plugin = "com.diffplug.gradle.spotless")
plugins.whenPluginAdded {
if (this is JavaPlugin) {
configure<SpotlessExtension> {
java {
googleJavaFormat()
}
}
}
}
}
Build output:
Execution failed for task ':version:spotlessJavaCheck'. org.gradle.api.GradleException: The following files had format violations:
version\build\generated\src\constants\java\project\Version.java
Run 'gradlew.bat :version:spotlessApply' to fix these violations.
Caused by: org.gradle.api.GradleException: The following files had format violations:
version\build\generated\src\constants\java\project\Version.java
Run 'gradlew.bat :version:spotlessApply' to fix these violations.
at com.diffplug.gradle.spotless.SpotlessCheck.formatViolationsFor(SpotlessCheck.java:87)
at com.diffplug.gradle.spotless.SpotlessCheck.performAction(SpotlessCheck.java:76)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
....
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 21 (10 by maintainers)
Version 5.8.2 works correctly, as far as I can tell.
The
java.nio.file.DirectoryNotEmptyExceptionbug, and also theIllegal char <:> at indexbug that @valfirst reported are both fixed in4.1.0.Happy to discuss further ways to make target/targetExclude easier to use, but I think the
heart(surface) of this issue has been solved.@valfirst turns out your bug is unrelated to @davidburstromspotify’s issue. Thanks for reporting though, it was useful, and we have a fix in #588. You will see vastly improved performance adopting the next version once it is published.
@davidburstromspotify I tried to reproduce, and here was what I observed:
targetExclude 'build/**', I getorg.gradle.api.GradleException: The following files had format violations, which is correct and expectedtargetExclude 'build/**', I get a different error,java.nio.file.DirectoryNotEmptyException, which exposes a bug in our incremental update. But if I do a clean and thenspotlessCheck, the check passes, as expected. When you said “The same build error happened.”, is there any chance it was actually a different error? Regardless, we need to fix theDirectoryNotEmptyExceptionbug.