Unsafe configuration resolution warning when getting a task's dependencies in Gradle 5.0-rc-1


(Ross Goldberg) #1

After having upgraded Gradle from 4.10.2 to 5.0-rc-1, I get many unsafe configuration resolution warnings like the one included below when building while applying my modified Jigsaw plugin, which reads a task’s dependencies (seemingly successfully, despite the warnings) using task.getTaskDependencies().getDependencies(task).

I’ve simplified my plugin to the bare minimum required to output the warning, and I’ve attached it along with a use case in a zip (just run ./gradlew --stacktrace clean build from the library directory).

The configuration 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-rc-1/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

(where <config-path> is a placeholder for an actual config path like :compileClasspath)

How can I avoid these warnings while still getting the dependencies of a Task at the Task Graph Ready phase?

Thanks.

gradle-5.0-unsafe-configuration-resolution.zip (60.3 KB)