|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD |
public interface ResolutionStrategy
Defines the strategies around dependency resolution. For example, forcing certain dependency versions, conflict resolutions or snapshot timeouts.
Examples:
configurations.all { resolutionStrategy { // fail eagerly on version conflict (includes transitive dependencies) // e.g. multiple different versions of the same dependency (group and name are equal) failOnVersionConflict() // force certain versions of dependencies (including transitive) // *append new forced modules: force 'asm:asm-all:3.3.1', 'commons-io:commons-io:1.4' // *replace existing forced modules with new ones: forcedModules = ['asm:asm-all:3.3.1'] // cache dynamic versions for 10 minutes cacheDynamicVersionsFor 10, 'minutes' // don't cache changing modules at all cacheChangingModulesFor 0, 'seconds' } }
Method Summary | |
---|---|
void
|
cacheChangingModulesFor(int value, java.lang.String units)
Sets the length of time that changing modules will be cached, with units expressed as a String. |
void
|
cacheChangingModulesFor(int value, java.util.concurrent.TimeUnit units)
Sets the length of time that changing modules will be cached. |
void
|
cacheDynamicVersionsFor(int value, java.lang.String units)
Sets the length of time that dynamic versions will be cached, with units expressed as a String. |
void
|
cacheDynamicVersionsFor(int value, java.util.concurrent.TimeUnit units)
Sets the length of time that dynamic versions will be cached. |
ResolutionStrategy
|
failOnVersionConflict()
In case of conflict, Gradle by default uses the newest of conflicting versions. |
ResolutionStrategy
|
force(java.lang.Object... forcedModuleNotations)
Allows forcing certain versions of dependencies, including transitive dependencies. |
java.util.Set
|
getForcedModules()
Returns currently configured forced modules. |
ResolutionStrategy
|
setForcedModules(java.lang.Object... forcedModuleNotations)
Allows forcing certain versions of dependencies, including transitive dependencies. |
Method Detail |
---|
public void cacheChangingModulesFor(int value, java.lang.String units)
A convenience method for cacheChangingModulesFor(int, java.util.concurrent.TimeUnit) with units expressed as a String. Units are resolved by calling the valueOf(String) method of java.util.concurrent.TimeUnit with the upper-cased string value.
value
- The number of time unitsunits
- The units
public void cacheChangingModulesFor(int value, java.util.concurrent.TimeUnit units)
Gradle caches the contents and artifacts of changing modules. By default, these cached values are kept for 24 hours, after which the cached entry is expired and the module is resolved again.
Use this method to provide a custom expiry time after which the cached entries for any changing module will be expired.
value
- The number of time unitsunits
- The units
public void cacheDynamicVersionsFor(int value, java.lang.String units)
A convenience method for cacheDynamicVersionsFor(int, java.util.concurrent.TimeUnit) with units expressed as a String. Units are resolved by calling the valueOf(String) method of java.util.concurrent.TimeUnit with the upper-cased string value.
value
- The number of time unitsunits
- The units
public void cacheDynamicVersionsFor(int value, java.util.concurrent.TimeUnit units)
Gradle keeps a cache of dynamic version => resolved version (ie 2.+ => 2.3). By default, these cached values are kept for 24 hours, after which the cached entry is expired and the dynamic version is resolved again.
Use this method to provide a custom expiry time after which the cached value for any dynamic version will be expired.
value
- The number of time unitsunits
- The units
public ResolutionStrategy failOnVersionConflict()
configurations.all { resolutionStrategy.failOnVersionConflict() }
public ResolutionStrategy force(java.lang.Object... forcedModuleNotations)
It accepts following notations:
configurations.all { resolutionStrategy.force 'asm:asm-all:3.3.1', 'commons-io:commons-io:1.4' }
forcedModuleNotations
- typically group:name:version notations to append
public java.util.Set getForcedModules()
public ResolutionStrategy setForcedModules(java.lang.Object... forcedModuleNotations)
For information on notations see force(Object...)
Example:
configurations.all { resolutionStrategy.forcedModules = ['asm:asm-all:3.3.1', 'commons-io:commons-io:1.4'] }
forcedModuleNotations
- typically group:name:version notations to set
Groovy Documentation