Gradle does not update snapshot dependencies

I have a gradle project that has a dependency on another gradle project. Dependence is published on our internal nexus server and can be easily resolved.

After the dependency has been cached locally, I cannot update it unless I switch to --refresh-dependencies for the gradle command (or delete it manually from the cache).

Having been on the Internet, I found many people with the same problem, and it was suggested to mark the dependency as a change (although this is not strictly necessary, since it is implicit from the name -SNAPSHOT) and add this:

configurations.all {
    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

however this does not work for me, it will always use the cached version until 24 hours by default gradle is set, after which it will be reloaded.

Does anyone know what else I can lose, or how I can diagnose what gradle does and why it is not going to download new versions? nexus

+4
source share
1 answer

After some trial and error, I found that the reason the function does not work properly was due to the fact that we used the plugin spring-boot. The plugin spring-bootuses its own dependency management module, which has its own configuration for changing modules:

dependencyManagement {
    resolutionStrategy {
        cacheChangingModulesFor 0, 'seconds'
    }
}

Adding this fragment to the gradle file makes the modules always load.

+9
source

Source: https://habr.com/ru/post/1657596/


All Articles