Skip to content

Instantly share code, notes, and snippets.

@eclecticlogic
Created August 10, 2014 00:29
Show Gist options
  • Save eclecticlogic/e6df61a1e52e5c2efebc to your computer and use it in GitHub Desktop.
Save eclecticlogic/e6df61a1e52e5c2efebc to your computer and use it in GitHub Desktop.
Gradle resolutionStrategy
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']
// add a dependency resolve rule
eachDependency { DependencyResolveDetails details ->
//specifying a fixed version for all libraries with 'org.gradle' group
if (details.requested.group == 'org.gradle') {
details.useVersion'1.4'
}
//changing 'groovy-all' into 'groovy':
if (details.requested.name == 'groovy-all') {
details.useTarget group: details.requested.group, name: 'groovy', version: details.requested.version
}
}
// cache dynamic versions for 10 minutes
cacheDynamicVersionsFor 10*60, 'seconds'
// don't cache changing modules at all
cacheChangingModulesFor 0, 'seconds'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment