api / org.gradle.api.artifacts / DependencyConstraint

DependencyConstraint

@Incubating interface DependencyConstraint : ModuleVersionSelector, HasConfigurableAttributes<DependencyConstraint>

Represents a constraints over all, including transitive, dependencies.

Since
4.5

Functions

attributes

abstract fun attributes(configureAction: Action<in AttributeContainer>): DependencyConstraint

Mutates the attributes of this constraint. Attributes are used during dependency resolution to select the appropriate target variant, in particular when a single component provides different variants.

because

abstract fun because(reason: String): Unit

Sets the reason why this dependency constraint should be used.

getAttributes

abstract fun getAttributes(): AttributeContainer

Returns the attributes for this constraint. Mutation of the attributes of a constraint must be done through the #attributes(Action) method.

getReason

abstract fun getReason(): String

Returns a reason why this dependency constraint 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.

version

abstract fun version(configureAction: Action<in MutableVersionConstraint>): Unit

Configures the version constraint for this dependency constraint.

Inherited Functions

getGroup

abstract fun getGroup(): String

The group of the module.

getModule

abstract fun getModule(): ModuleIdentifier

The module identifier of the component. Returns the same information as #getGroup() and #getName().

getName

abstract fun getName(): String

The name of the module.

getVersion

abstract fun getVersion(): String

The version of the module

getVersionConstraint

abstract fun getVersionConstraint(): VersionConstraint

Returns the version constraint to be used during selection.

matchesStrictly

abstract fun matchesStrictly(identifier: ModuleVersionIdentifier): Boolean

To match strictly means that the given identifier needs to have equal group, module name and version. It does not smartly match dynamic versions, e.g. '1.+' selector does not strictly match '1.2' identifier.