gradle dependencyInsight: Usage & Common CI Errors
Ask Gradle why one dependency resolved to the version it did.
dependencyInsight is the built-in Gradle task that explains the resolution of a single dependency: which version was selected, every path that requested it, and the reason (conflict resolution, constraint, forced version) behind the choice.
What it does
dependencyInsight inverts the dependencies report: instead of the whole tree, it focuses on one module and shows all requesters and the selection reason. It requires --dependency and usually --configuration to target the right classpath.
Common usage
./gradlew dependencyInsight \
--dependency com.google.guava:guava \
--configuration runtimeClasspath
./gradlew :app:dependencyInsight --dependency jackson-databindCommon error in CI (and the fix)
Symptom: the task prints "No dependencies matching given input were found" for a library you know is on the classpath. Cause: the coordinate is wrong, or it is not present in the configuration you queried. Fix: use the group:name form (or just the name), and target the correct configuration (e.g. runtimeClasspath vs compileClasspath) - a runtime-only dependency will not appear in compileClasspath.