api / org.gradle.api.artifacts / DependencyResolveDetails / useVersion

useVersion

abstract fun useVersion(version: String): Unit

Allows to override the version when the dependency #getRequested() is resolved. Can be used to select a version that is different than requested. Forcing modules via ResolutionStrategy#force(Object...) uses this capability. Configuring a version different than requested will cause #getTarget() method return a target module with updated target version.

If you need to change not only the version but also group or name please use the #useTarget(Object) method.

Parameters

version - to use when resolving this dependency, cannot be null. It is valid to configure the same version as requested.