Sounds like you’ve got a pretty good understanding of the way Gradle checks for missing modules and artifacts.
The problem comes down to the following: 1. The order of declared repositories is significant, so early repositories should be used in preference to later. 2. Gradle wants to provide consistent results for dependency resolution. This should not be affected by the state of the cache, within reasonable timeout periods.
- Gradle treats the absence of a module as transient, and so needs to recheck periodically. (On the other hand, Gradle treats the presence of a module as permanent, and will not check later). 4. There’s no (fully supported) way to configure the period in which Gradle checks for missing modules and artifacts. (The DSL you’re using is experimental and subject to change at any time).
So to answer your specific questions: - Yep, I think it makes sense to make this value configurable at the same level as ‘cacheChangingModulesFor’. - Possibly, we should always use a module we found previously in preference to checking for one where we previously detected it’s absence. But this would require us to re-examine the assumption mentioned in 3 above.
I’ve raised GRADLE-3107 for the first point. Would you be interested in working with us to provide a pull request?