gradle-dependencyinsight
Explain why a specific dependency was included
TLDR
Show insight for a specific dependency
Show insight for a dependency in a specific configuration
Show insight for a specific subproject
Show insight with the full dependency path
SYNOPSIS
gradle dependencyInsight [--dependency <notation>] [--configuration <name>] [--include-build <path>] [gradle options]
PARAMETERS
--dependency <notation>
Dependency to inspect (e.g., com.google.guava:guava:30.1-jre)
--configuration <name>
Target configuration (default: runtimeClasspath)
--include-build <path>
Composite build to include in analysis
DESCRIPTION
gradle dependencyInsight is a Gradle task that analyzes why a specific dependency was chosen during resolution, displaying the dependency graph paths leading to it. It reveals conflict resolutions, version substitutions, overrides, and transitive dependencies.
Ideal for debugging version mismatches or unexpected artifacts in complex projects. Specify a dependency using group:artifact or group:artifact:version notation and a configuration like compileClasspath or runtimeClasspath. The output shows selected paths with * markers and reasons like 'forced', 'selected by rule', or 'conflict resolved'.
Enhances transparency in builds using platforms, enforced versions, or composite builds. Use alongside gradle dependencies for full graphs. Supports Gradle's latest resolution strategies.
CAVEATS
Requires a Gradle project directory; dependency notation must match exactly; console-only output; Gradle 2.12+ required.
EXAMPLE
gradle dependencyInsight --dependency org.slf4j:slf4j-api --configuration compileClasspath
Shows resolution tree for slf4j-api in compileClasspath.
OUTPUT FORMAT
ASCII tree with +--- for paths; * marks selected dependency; reasons in parentheses.
HISTORY
Introduced in Gradle 2.12 (2016) to improve dependency debugging; enhanced in 4.x+ with variant and platform support.


