Dependency (Gradle API 8.11)

Package org.gradle.api.artifacts

## Interface Dependency

- All Known Subinterfaces:
    `ClientModule`, `ExternalDependency`, `ExternalModuleDependency`, `FileCollectionDependency`, `MinimalExternalModuleDependency`, `ModuleDependency`, `ProjectDependency`, `SelfResolvingDependency`

      public interface Dependency

  A `Dependency` represents a dependency on the artifacts from a particular source. A source can be an Ivy module, a Maven POM, another Gradle project, a collection of Files, etc... A source can have zero or more artifacts.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `ARCHIVES_CONFIGURATION` |
    `static java.lang.String` | `CLASSIFIER` |
    `static java.lang.String` | `DEFAULT_CONFIGURATION` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `because​(java.lang.String reason)` | Sets the reason why this dependency should be used.
    `boolean` | `contentEquals​(Dependency dependency)` | Deprecated. Use `Object.equals(Object)` instead.
    `Dependency` | `copy()` | Creates and returns a new dependency with the property values of this one.
    `java.lang.String` | `getGroup()` | Returns the group of this dependency.
    `java.lang.String` | `getName()` | Returns the name of this dependency.
    `java.lang.String` | `getReason()` | Returns a reason why this dependency should be used, in particular with regards to its version.
    `java.lang.String` | `getVersion()` | Returns the version of this dependency.

- - ### Field Detail

    - #### DEFAULT_CONFIGURATION

          static final java.lang.String DEFAULT_CONFIGURATION

      See Also:
        Constant Field Values

    - #### ARCHIVES_CONFIGURATION

          static final java.lang.String ARCHIVES_CONFIGURATION

      See Also:
        Constant Field Values

    - #### CLASSIFIER

          static final java.lang.String CLASSIFIER

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getGroup

          @Nullable
          java.lang.String getGroup()

      Returns the group of this dependency. The group is often required to find the artifacts of a dependency in a repository. For example, the group name corresponds to a directory name in a Maven like repository. Might return null.

    - #### getName

          java.lang.String getName()

      Returns the name of this dependency. The name is almost always required to find the artifacts of a dependency in a repository. Never returns null.

    - #### getVersion

          @Nullable
          java.lang.String getVersion()

      Returns the version of this dependency. The version is often required to find the artifacts of a dependency in a repository. For example the version name corresponds to a directory name in a Maven like repository. Might return null.

    - #### contentEquals

          @Deprecated
          boolean contentEquals​(Dependency dependency)

      Deprecated.
      Use `Object.equals(Object)` instead.
      Returns whether two dependencies have identical values for their properties. A dependency is an entity with a key. Therefore dependencies might be equal and yet have different properties.
      Parameters:
        `dependency` - The dependency to compare this dependency with

    - #### copy

          Dependency copy()

      Creates and returns a new dependency with the property values of this one.
      Returns:
        The copy. Never returns null.

    - #### getReason

          @Nullable
          java.lang.String getReason()

      Returns a reason why this dependency should be used, in particular with regards to its version. The dependency report will use it to explain why a specific dependency was selected, or why a specific dependency version was used.
      Returns:
        a reason to use this dependency
      Since:
        4.6

    - #### because

          void because​(@Nullable
                       java.lang.String reason)

      Sets the reason why this dependency should be used.
      Since:
        4.6