api / org.gradle.api.artifacts / Dependency

Dependency

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.

Properties

ARCHIVES_CONFIGURATION

static val ARCHIVES_CONFIGURATION: String

CLASSIFIER

static val CLASSIFIER: String

DEFAULT_CONFIGURATION

static val DEFAULT_CONFIGURATION: String

Functions

because

abstract fun because(reason: String): Unit

Sets the reason why this dependency should be used.

contentEquals

abstract fun contentEquals(dependency: Dependency): Boolean

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.

copy

abstract fun copy(): Dependency

Creates and returns a new dependency with the property values of this one.

getGroup

abstract fun getGroup(): String

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

abstract fun getName(): String

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.

getReason

abstract fun getReason(): String

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.

getVersion

abstract fun getVersion(): String

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.

Inheritors

ModuleDependency

interface ModuleDependency : Dependency, HasConfigurableAttributes<ModuleDependency>

A ModuleDependency is a org.gradle.api.artifacts.Dependency on a module outside the current project.

For examples on configuring the exclude rules please refer to #exclude(java.util.Map).

SelfResolvingDependency

interface SelfResolvingDependency : Dependency, Buildable

A SelfResolvingDependency is a Dependency which is able to resolve itself, independent of a repository.