-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configuration 'spotless-*' was resolved during configuration time #1380
Comments
I have the exact same issue. Anyone has any ideas? Seem to have happened upgrading van Gradle 7.3.3 to Gradle 7.4. Spotless is no longer working for me. |
Same here, anyone got a solution ? |
An opensource reproduction would be very welcome, I haven't seen this happen in my usage. |
Our internal project which uses Gradle 7.6 just encountered this issue. However, this version of Gradle appears to treat this as an error instead of a warning. I stepped through each version of spotless and it appears that the issue originated here. The gradle output includes a reference to gradle/gradle#2298 |
I hope we get an opensource reproduction someday, but in the meantime I bet that predeclaring deps will solve the issue. https://github.com/diffplug/spotless/tree/main/plugin-gradle#dependency-resolution-modes |
@nedtwigg you can find a reproducer here https://github.com/getsentry/sentry-java/pull/2563/files#diff-c0dfa6bc7a8685217f70a860145fbdf416d449eaff052fa28352c5cec1a98c06 I was trying to find a workaround for #1572, but unsuccessful - the build is still failing on Gradle 8+ due to an implicit dependency between just check it out locally ( We're basically blocked on updating to Gradle 8+ because of this - I'm unsure how to fix it other than disable spotless for |
This bug also reproduces for me. While I don't have an open-source demo app (yet), I do have some extra information I can add. As others have mentioned, this only reproduces with newer versions of Gradle. But it also only reproduces with newer versions of Spotless. Specifically, we can see this bug was introduced with Spotless 6.6.1. This error is not encountered with 6.6.0. Adding predeclaration dependencies, as mentioned in @nedtwigg's comment above, restores the 6.6.0 behavior. However, it seems like there's another bug that was introduced in 6.6.0 that causes Gradle's configuration stage to take ages. Switching from 6.5.2 to 6.6.0 increases the configuration time on my project from 20 seconds to 6 minutes. So for now, if you need to update Gradle, it appears that you can, at best, use Spotless 6.5.2. |
I'm able to reproduce this on EDIT: I was able to work-around this issue by predeclaring my Spotless dependencies. Here's my config: allprojects {
val configureSpotless: SpotlessExtension.() -> Unit = {
kotlin {
target("**/*.kt", "**/*.kts")
ktlint("0.48.2")
endWithNewline()
indentWithSpaces()
trimTrailingWhitespace()
}
}
if (project === rootProject) {
spotless { predeclareDeps() }
extensions.configure<SpotlessExtensionPredeclare>(configureSpotless)
} else {
extensions.configure(configureSpotless)
}
} |
Just wanted to mention one more path leading to the problem (an attempt to resolve a configuration at configuration-time):
the JvmLocalCache tries to resolve "LazyForwardingEquality", leading to an attempt to compute the JarState, which tries to resolve the configuration from which google format is loaded. The message here is confusing - the nested exception is actually from palantir's consistent versions plugin, which explicitly forbids resolving configurations before execution (as does newer Gradle, I believe):
|
I do have a small repro, although I'm no longer sure - maybe it's palantir plugin's fault... The problem seems to surface only when there is a lazy task dependency in the task graph. Essentially something like this:
The code is here: https://github.com/dweiss/spotless-conf-resolution-bug It fails every time (gradlew spotlessApply --stacktrace). I also took a look at what palantir's plugin does behind the scenes - it attaches an action block to all configurations to explicitly forbid those configurations from being resolved in the configuration phase:
I don't know whether this is an incorrect assumption on their behalf or maybe spotless indeed shouldn't rely on resolved artifacts as part of the lazy cache (instead, perhaps it should rely on the full module id?). Sorry it's not more helpful in solving the issue. :( |
Android studio build analyzer: com.diffplug.spotless: not compatible The version of this plugin used in this build is not compatible with Configuration cache and we don’t know the version when it becomes compatible. Plugin version: 6.21.0 Here is my build.gradle(project):
|
Happens also in the libgdx builds |
Starting to get this warning every time I run spotlessApply command on my new Android app project.
I'm using Gradle 7.4 and here's my root
build.gradle.kts
.How do I make that warning go away?
The text was updated successfully, but these errors were encountered: