Is there a way to configure a Gradle project to always refresh dependencies in the Gradle cache (not using --refresh-dependencies)?
configurations.all {
resolutionStrategy {
cacheDynamicVersionsFor 0, "seconds"
cacheChangingModulesFor 0, "seconds"
}
}
For more information, see Fine-tuned control over dependency caching in the Gradle User Guide.
Hmm, I tried setting cacheChangingModulesFor 0, “seconds” for my configuration and it didn’t seem to work.Here’s what I’m doing:
Component B depends on Component A version 1.0.
Resolving the configuration caches Component A version 1.0, great.
Component A version 1.0 is then updated in the repository to include an additional artifact. Resolving the configuration again doesn’t update Component A version 1.0 in the cache.
Using --refresh-dependencies does the trick. How does Gradle know the dependency has changed?
Did you mark the dependency as changing?
dependencies {
compile("foo:bar:1.0") { changing = true }
}
Works, thank you