Package org.gradle.api.tasks.diagnostics

# Class DependencyInsightReportTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.tasks.diagnostics.DependencyInsightReportTask

All Implemented Interfaces:
  `Comparable<Task>`, `org.gradle.api.internal.DynamicObjectAware`, `org.gradle.api.internal.TaskInternal`, `Named`, `ExtensionAware`, `Task`, `Configurable<Task>`

@DisableCachingByDefault(because="Produces only non-cacheable console output") public abstract class DependencyInsightReportTask extends DefaultTask
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 `getEffectiveDependencySpec()` and `getConfiguration()`.

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

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface org.gradle.api.Named

  `Named.Namer`

- ## Field Summary

  ### Fields inherited from interface org.gradle.api.Task

  `TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DependencyInsightReportTask()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `dependencySpec(@Nullable Spec<DependencyResult> dependencySpec)`
  The dependency spec selects the dependency (or dependencies if multiple matches found) to show the report for.
  `protected org.gradle.api.internal.attributes.AttributesFactory`
  `getAttributesFactory()`
  An injected `AttributesFactory`.
  `Property<Configuration>`
  `getConfiguration()`
  Configuration to look the dependency in
  `abstract Property<String>`
  `getDependencyNotation()`
  Configures the dependency to show the report for.
  `protected Provider<Spec<DependencyResult>>`
  `getEffectiveDependencySpec()`
  The effective dependency spec selects the dependency (or dependencies if multiple matches found) to show the report for.
  `protected abstract org.gradle.api.internal.attributes.AttributesFactory`
  `getImmutableAttributesFactory()`
  Deprecated.
  `Property<Boolean>`
  `getIsShowSinglePathToDependency()`
  `protected abstract ObjectFactory`
  `getObjectFactory()`
  `protected abstract ProviderFactory`
  `getProviderFactory()`
  `abstract Property<ResolvedComponentResult>`
  `getRootComponentProperty()`
  The root component of the dependency graph to be inspected.
  `abstract Property<Boolean>`
  `getShowingAllVariants()`
  Show all variants of each displayed dependency.
  `abstract Property<Boolean>`
  `getShowSinglePathToDependency()`
  Tells if the report should only display a single path to each dependency, which can be useful when the graph is large.
  `protected abstract org.gradle.internal.logging.text.StyledTextOutputFactory`
  `getTextOutputFactory()`
  `protected abstract org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.VersionComparator`
  `getVersionComparator()`
  `protected abstract org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.VersionParser`
  `getVersionParser()`
  `protected abstract org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.VersionSelectorScheme`
  `getVersionSelectorScheme()`
  `void`
  `report()`
  `void`
  `setConfiguration(@Nullable String configuration)`
  Deprecated.
  `void`
  `setConfiguration(@Nullable Configuration configuration)`
  Sets the configuration to look the dependency in.
  `void`
  `setConfigurationName(@Nullable String configurationName)`
  Sets the configuration (via name) to look the dependency in.
  `void`
  `setDependencySpec(@Nullable Object dependencyInsightNotation)`
  Configures the dependency to show the report for.
  `void`
  `setDependencySpec(@Nullable Spec<DependencyResult> configuredDependencySpec)`
  Deprecated.
  use `dependencySpec(Spec)` instead
  `void`
  `setShowSinglePathToDependency(boolean showSinglePathToDependency)`
  Tells if the report should only display a single path to each dependency, which can be useful when the graph is large.

  ### Methods inherited from class org.gradle.api.DefaultTask

  `compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService`

  ### Methods inherited from class org.gradle.api.internal.AbstractTask

  `acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjects`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.gradle.api.Task

  `doNotTrackState, notCompatibleWithConfigurationCache`

- ## Constructor Details

  - ### DependencyInsightReportTask

    public DependencyInsightReportTask()

- ## Method Details

  - ### getRootComponentProperty

    @Input @Optional public abstract Property<ResolvedComponentResult> getRootComponentProperty()
    The root component of the dependency graph to be inspected.
    Since:
      7.5

  - ### getEffectiveDependencySpec

    @Internal @Incubating protected Provider<Spec<DependencyResult>> getEffectiveDependencySpec()
    The effective 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.
    Since:
      9.7.0

  - ### setDependencySpec

    @Deprecated public void setDependencySpec(@Nullable Spec<DependencyResult> configuredDependencySpec)
    Deprecated.
    use `dependencySpec(Spec)` instead
    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.

  - ### setDependencySpec

    public void setDependencySpec(@Nullable 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 `setDependencySpec(Spec)`

  - ### dependencySpec

    @Incubating public void dependencySpec(@Nullable 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.
    Since:
      9.7.0

  - ### getDependencyNotation

    @Incubating @Input @Optional public abstract Property<String> getDependencyNotation()
    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.

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

        gradle dependencyInsight --dependency slf4j

    Since:
      9.7.0

  - ### getConfiguration

    @Internal public Property<Configuration> getConfiguration()
    Configuration to look the dependency in

  - ### setConfiguration

    public void setConfiguration(@Nullable Configuration configuration)
    Sets the configuration to look the dependency in.

  - ### setConfigurationName

    @Incubating public void setConfigurationName(@Nullable 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

    Since:
      9.7.0

  - ### setConfiguration

    @Deprecated public void setConfiguration(@Nullable String configuration)
    Deprecated.

  - ### getShowSinglePathToDependency

    @Internal public abstract Property<Boolean> getShowSinglePathToDependency()
    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.
    Since:
      4.9

  - ### setShowSinglePathToDependency

    public void setShowSinglePathToDependency(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.

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

        gradle dependencyInsight --single-path

    Since:
      4.9

  - ### getIsShowSinglePathToDependency

    @Internal public Property<Boolean> getIsShowSinglePathToDependency()

  - ### getShowingAllVariants

    @Internal public abstract Property<Boolean> getShowingAllVariants()
    Show all variants of each displayed dependency.

    Due to internal limitations, this option only works when the `configuration` is unresolved before the execution of this task.

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

        gradle dependencyInsight --all-variants

    Since:
      7.5

  - ### getTextOutputFactory

    @Inject protected abstract org.gradle.internal.logging.text.StyledTextOutputFactory getTextOutputFactory()

  - ### getVersionSelectorScheme

    @Inject protected abstract org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.VersionSelectorScheme getVersionSelectorScheme()

  - ### getVersionComparator

    @Inject protected abstract org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.VersionComparator getVersionComparator()

  - ### getVersionParser

    @Inject protected abstract org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.VersionParser getVersionParser()

  - ### getImmutableAttributesFactory

    @Deprecated @Inject protected abstract org.gradle.api.internal.attributes.AttributesFactory getImmutableAttributesFactory()
    Deprecated.
    An injected `AttributesFactory`.
    Since:
      4.9

  - ### getAttributesFactory

    @Internal @Incubating protected org.gradle.api.internal.attributes.AttributesFactory getAttributesFactory()
    An injected `AttributesFactory`.

    Previously named `getImmutableAttributesFactory`, this method has been renamed for better internal alignment.

    Since:
      8.12

  - ### getObjectFactory

    @Inject protected abstract ObjectFactory getObjectFactory()

  - ### getProviderFactory

    @Inject protected abstract ProviderFactory getProviderFactory()

  - ### report

    public void report()