I am working to update our build to use Gradle 5.0 and encountered warning messages such as this:
The configuration :server:api:external was resolved without accessing the project in a safe manner. This may happen when a configuration is resolved from a thread not managed by Gradle or from a different project. See https://docs.gradle.org/5.0/userguide/troubleshooting_dependency_resolution.html#configuration_resolution_constraints for more details. This behaviour has been deprecated and is scheduled to be removed in Gradle 6.0.
I know where in our custom tasks this is coming from and the referenced documentation provides a good suggestion for how to resolve it:
In most cases, the deprecation warning can be fixed by defining a configuration in the project where the resolution is occurring and setting it to extend from the configuration in the other project.
So, I set up my configuration like so:
project.configurations
{
dedup.extendsFrom(project.project(":server:api").configurations.external)
}
When it comes time to use this dedup configuration, I find that, though the configuration object indicates it extends from “:server:api.configurations.external”, the file collection it resolves to is the collection for the external configuration for THIS project, not the “:server:api” project.
Am I missing something here? I had thought that it might be an evaluation ordering problem, but then I would expect that the configuration would have nothing in it, not the dependencies from this project.
Thanks!
Susan