# DependencyInsightReportTask

API Documentation: | `DependencyInsightReportTask`

Generates a report that attempts to answer questions like:

- Why is this dependency in the dependency graph?
- Exactly which dependencies are pulling this dependency into the graph?
- What is the actual version (i.e. *selected* version) of the dependency that will be used? Is it the same as what was *requested*?
- Why is the *selected* version of a dependency different to the *requested*?
- What variants are available for this dependency?

Use this task to get insight into a particular dependency (or dependencies) and find out what exactly happens during dependency resolution and conflict resolution. If the dependency version was forced or selected by the conflict resolution this information will be available in the report.

While the regular dependencies report (`DependencyReportTask`) shows the path from the top level dependencies down through the transitive dependencies, the dependency insight report shows the path from a particular dependency to the dependencies that pulled it in. That is, it is an inverted view of the regular dependencies report.

The task requires setting the dependency spec and the configuration. For more information on how to configure those please refer to docs for `DependencyInsightReportTask.getEffectiveDependencySpec()` and `DependencyInsightReportTask.getConfiguration()`.

The task can also be configured from the command line. For more information please refer to `DependencyInsightReportTask.getEffectiveDependencySpec()`}, `DependencyInsightReportTask.setConfigurationName(java.lang.String)`, `DependencyInsightReportTask.getShowSinglePathToDependency()`, and `DependencyInsightReportTask.getShowingAllVariants()`.

### Properties

Property | Description
`configuration` | Configuration to look the dependency in
`dependencySpec` | The dependency spec selects the dependency (or dependencies if multiple matches found) to show the report for. The spec receives an instance of `DependencyResult` as parameter.
`showSinglePathToDependency` | Tells if the report should only display a single path to each dependency, which can be useful when the graph is large. This is false by default, meaning that for each dependency, the report will display all paths leading to it.
`showingAllVariants` | Show all variants of each displayed dependency.

### Methods

No methods

### Script blocks

No script blocks

### Property details

#### ``Property`<`Configuration`>` `configuration`

Configuration to look the dependency in

Default with `java` plugin:
  `compileClasspath` configuration

#### ``Spec`<`DependencyResult`>` `dependencySpec` (write-only)

The dependency spec selects the dependency (or dependencies if multiple matches found) to show the report for. The spec receives an instance of `DependencyResult` as parameter.

Default with `java` plugin:
  -

#### ``Property`<`Boolean`>` `showSinglePathToDependency`

Tells if the report should only display a single path to each dependency, which can be useful when the graph is large. This is false by default, meaning that for each dependency, the report will display all paths leading to it.

Default with `java` plugin:
  false

#### ``Property`<`Boolean`>` `showingAllVariants`

Show all variants of each displayed dependency.

Due to internal limitations, this option only works when the `DependencyInsightReportTask.getConfiguration()` is unresolved before the execution of this task.

This method is exposed to the command line interface. Example usage:

    gradle dependencyInsight --all-variants

Default with `java` plugin:
  false