Hi! We're hunting down Gradle 9 deprecations, but ...
# community-support
m
Hi! We're hunting down Gradle 9 deprecations, but there's one I don't understand why it's happening.
it resolves dependencies dynamically, based on the result of the execution of another task (
findBaseline
)
for this purpose it uses detached configurations
unfortunately, we're getting:
Resolution of the configuration :detachedConfiguration6 was attempted from a context different than the project context. Have a look at the documentation to understand why this is a problem and how it can be resolved. This behavior has been deprecated.
This will fail with an error in Gradle 9.0.
what would be the proper way to fix this?
v
Maybe it has to do with the comment above
// but we'll have to find a better solution which doesn't reach into other project's state
m
quite possible, but I don't think we have an alternative 😕
if so the message is a bit misleading, since this is a different case, where a configuration was created in a different project, then resolved in the current one
v
The linked thread was about Gradle 2.0, maybe you don't need to use root project's configurations anymore?
m
no this was added way after 2.0
I don't think this has been solved, but we're going to check
v
since this is a different case, where a configuration was created in a different project, then resolved in the current one
Isn't that exactly the case? You create the configuration in the root project and resolve it in the current one?
m
used to be that a configuration was resolved in a non Gradle managed thread
v
Hm, I see
Yeah, probably something else. At least this works without deprecation warning in 8.14.3 and 9.0.0-rc-3:
Copy code
val foo by tasks.registering {
    val conf: FileCollection = rootProject.configurations.detachedConfiguration(project.dependencies.create("commons-io:commons-io:+"))
    inputs.files(conf)
    doLast {
        conf.forEach { file -> println("file = $file") }
    }
}
👍 1
Also with
project.dependencies.create(project)
m
right, really puzzling...