Dependency caching and update: dynamic, changing, with unreliable maven repository

(rupert THURNER) #1

i am wondering what the reliable strategy is to update a snapshot dependency coming out of a maven repository: * check every 10 minutes * if the maven respository is not reachable, use what is in the cache even if it is older than 10 minutes

i saw “cacheDynamicVersionsFor” and “cacheChangingModulesFor” but i could not find any documentation what a dynamic version or a changing module would be. is -SNAPSHOT automatically “changing” or is it included in “dynamic version”, or is it necessary to state “changing” at the dependency and add "cacheChangingModulesFor 10, ‘minutes’ " ?

i saw: * * * * *


A maven SNAPSHOT module is automatically considered a changing module (this does not apply to an ivy module named *-SNAPSHOT). So you don’t need to do anything to tell Gradle that the module is changing, but you do need to configure the cache timeout as you specified.

The complication is that Gradle won’t automatically use what’s in the cache if the timeout has expired and the remote repository is not available. If this is an infrequent case, you could run the build with ‘–offline’ when this occurs. If you need this to be automatically handled, it’s going to be a bit trickier: you’ll probably need to ping the repository separately before resolving…