Package: org.gradle.api.tasks.diagnostics

## [Groovy] Class DependencyInsightReportTask

- org.gradle.api.tasks.diagnostics.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*?
  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.setDependencySpec and DependencyInsightReportTask.setConfiguration.

  The task can also be configured from the command line. For more information please refer to DependencyInsightReportTask.setDependencySpec and DependencyInsightReportTask.setConfiguration

- - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `Configuration` | `configuration` Configuration to look the dependency in
    `Spec<DependencyResult>` | `dependencySpec` Selects the dependency (or dependencies if multiple matches found) to show the report for.

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `protected StyledTextOutputFactory` | `getTextOutputFactory()`
    `protected VersionMatcher` | `getVersionMatcher()`
    `void` | `report()`
    `void` | `setConfiguration(Configuration configuration)` Sets the configuration to look the dependency in.
    `void` | `setConfiguration(String configurationName)` Sets the configuration (via name) to look the dependency in.
    `void` | `setDependencySpec(Spec<DependencyResult> dependencySpec)` The dependency spec selects the dependency (or dependencies if multiple matches found) to show the report for.
    `void` | `setDependencySpec(Object dependencyInsightNotation)` Configures the dependency to show the report for.

- - ### Property Detail

    - #### Configuration configuration

      Configuration to look the dependency in

    - #### Spec<DependencyResult> dependencySpec

      Selects the dependency (or dependencies if multiple matches found) to show the report for.

  - ### Method Detail

    - #### @Inject protected StyledTextOutputFactory getTextOutputFactory()

    - #### @Inject protected VersionMatcher getVersionMatcher()

    - #### @TaskAction void report()

    - #### void setConfiguration(Configuration configuration)

      Sets the configuration to look the dependency in.

      Parameters:
        configuration

    - #### @Option(option = "configuration", description = "Looks for the dependency in given configuration.") void setConfiguration(String configurationName)

      Sets the configuration (via name) to look the dependency in.

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

          gradle dependencyInsight --configuration runtime --dependency slf4j

      Parameters:
        configurationName

    - #### void setDependencySpec(Spec<DependencyResult> 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.

      Parameters:
        dependencySpec

    - #### @Option(option = "dependency", description = "Shows the details of given dependency.") void setDependencySpec(Object dependencyInsightNotation)

      Configures the dependency to show the report for. Multiple notation formats are supported: Strings, instances of Spec and groovy closures. Spec and closure receive DependencyResult as parameter. Examples of String notation: 'org.slf4j:slf4j-api', 'slf4j-api', or simply: 'slf4j'. The input may potentially match multiple dependencies. See also DependencyInsightReportTask.setDependencySpec

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

          gradle dependencyInsight --dependency slf4j

      Parameters:
        dependencyInsightNotation