api / org.gradle.api.artifacts / MutableVersionConstraint

MutableVersionConstraint

@Incubating interface MutableVersionConstraint : VersionConstraint

A configurable version constraint. This is exposed to the build author, so that one can express more constraints on a version,

Since
4.4

Functions

getBranch

abstract fun getBranch(): String

Returns the branch to select versions from. When not null, select only versions that were built from the given branch.

prefer

abstract fun prefer(version: String): Unit

Sets the preferred version of this module. Any other rejection/strict constraint will be overriden.

reject

abstract fun reject(vararg versions: String): Unit

Declares a list of rejected versions. If such a version is found during dependency resolution, it will not be selected.

rejectAll

abstract fun rejectAll(): Unit

Rejects all versions of this component. Can be used to declare that a component is incompatible with another (typically, cannot have both a 2 different implementations of the same API).

setBranch

abstract fun setBranch(branch: String): Unit

Specifies the branch to select versions from.

strictly

abstract fun strictly(version: String): Unit

Sets the version as strict, meaning that if any other dependency version for this module disagrees with this version, resolution will fail.

Inherited Functions

getPreferredVersion

abstract fun getPreferredVersion(): String

The preferred version of a module. The preferred version of a module can typically be upgraded during dependency resolution, unless further constraints are added.

getRejectedVersions

abstract fun getRejectedVersions(): MutableList<String>

Returns the list of versions that this module rejects (which may be exact versions, or ranges, anything that fits into a version string).