-SNAPSHOT versions is not working


(Marcin Flis) #1

In my project use -SNAPSHOT dependencies. Recently I noticed, that changing module does not have any effect.

Example: My version is defined as follows"1.1.0-SNAPSHOT". I made an experiment. I used

 myConfig.resolvedConfiguration.resolvedArtifacts.each{

          logger.info " $symbol $it.file"

        }

to print out from where artifact comes from. When set mavenLocal() to be first in repositiories block, then I see that artifacts are pulled from local repository.
When I change remote repo to be first in list then i see that artifacts are pulled form remote repositories (~/.gradle/caches/…)

I tried to use --refresh-dependencies, I tried to use

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

and

{ changing = true }

Nothing works.

How to emulate “-SNAPSHOT” version in gradle? I mean that once a day, gradle will check all repositories, local and remote for the newest module and use it in builds

Right now it seems, that they are working like normal static dependecies(they take artifact form the first aviable repository and not even checking the rest of repositories)
gradle version: 3.1

UPDATE
After further investigation I found out that when i do not have Aritifacts in local repository and just rely on remote Archiva, Gradle downloads newer version from Archiva. So at least partially -SNAPSHOT dependencies are behaving as expected, but still Gradle does not check all repositories, but takes artifact form first available repository.