Package org.gradle.api.artifacts
Interface DependencyConstraint
-
- All Superinterfaces:
HasAttributes
,HasConfigurableAttributes<DependencyConstraint>
,ModuleVersionSelector
public interface DependencyConstraint extends ModuleVersionSelector, HasConfigurableAttributes<DependencyConstraint>
Represents a constraints over all, including transitive, dependencies.- Since:
- 4.5
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DependencyConstraint
attributes(Action<? super AttributeContainer> configureAction)
Mutates the attributes of this constraint.void
because(java.lang.String reason)
Sets the reason why this dependency constraint should be used.AttributeContainer
getAttributes()
Returns the attributes for this constraint.java.lang.String
getReason()
Returns a reason why this dependency constraint should be used, in particular with regards to its version.VersionConstraint
getVersionConstraint()
Returns the version constraint to be used during selection.void
version(Action<? super MutableVersionConstraint> configureAction)
Configures the version constraint for this dependency constraint.-
Methods inherited from interface org.gradle.api.artifacts.ModuleVersionSelector
getGroup, getModule, getName, getVersion, matchesStrictly
-
-
-
-
Method Detail
-
version
void version(Action<? super MutableVersionConstraint> configureAction)
Configures the version constraint for this dependency constraint.- Parameters:
configureAction
- the configuration action for the module version
-
getReason
@Nullable java.lang.String getReason()
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.- Returns:
- a reason to use this dependency constraint
- Since:
- 4.6
-
because
void because(@Nullable java.lang.String reason)
Sets the reason why this dependency constraint should be used.- Since:
- 4.6
-
getAttributes
AttributeContainer getAttributes()
Returns the attributes for this constraint. Mutation of the attributes of a constraint must be done through theattributes(Action)
method.- Specified by:
getAttributes
in interfaceHasAttributes
- Returns:
- the attributes container for this dependency
- Since:
- 4.8
-
attributes
DependencyConstraint attributes(Action<? super AttributeContainer> configureAction)
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.- Specified by:
attributes
in interfaceHasConfigurableAttributes<DependencyConstraint>
- Parameters:
configureAction
- the attributes mutation action- Since:
- 4.8
-
getVersionConstraint
VersionConstraint getVersionConstraint()
Returns the version constraint to be used during selection.- Returns:
- the version constraint
-
-