VersionConstraint (Gradle API 9.2.1) (original) (raw)

All Superinterfaces:

[Describable](../Describable.html "interface in org.gradle.api")

All Known Subinterfaces:

[MutableVersionConstraint](MutableVersionConstraint.html "interface in org.gradle.api.artifacts")


public interface VersionConstraintextends Describable

Represents a constraint that is used to match module versions to a dependency. Each of getPreferredVersion(), getRequiredVersion() and getStrictVersion() is represented by a version String, that can be compared against a module version to determine if the version matches.

Version syntax

Gradle supports different ways of declaring a version String:

Version ordering

Versions have an implicit ordering. Version ordering is used to:

Versions are ordered based on the following rules:

Since:

4.4

[getBranch](#getBranch%28%29)()
The branch to select versions from.
The preferred version of a module (which may be an exact version or a version range).
Returns the list of versions that this module rejects (which may be exact versions, or ranges, anything that fits into a version string).
The required version of a module (which may be an exact version or a version range).
The strictly required version of a module (which may be an exact version or a version range).