Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle "changing" property implied by SNAPSHOT version?

Tags:

gradle

Gradle 1.6.

It looks as if having a SNAPSHOT Maven-style dependency marks that dependency as changing behind the scenes. Is that correct?

With compile 'com.X.Y:myname:0.1.0-SNAPSHOT', if I print dependencies through

task printAllDependencies << {
configurations*.allDependencies*.each {
    def info = it.toString()
    if (it instanceof ExternalModuleDependency) {
        info += ',changing=' + it.isChanging()
    }
    System.out.println info
}
}

I notice that even for SNAPSHOT dependencies, changing is reported as false:

...

DefaultExternalModuleDependency{group='com.X.Y', name='myname', version='0.1.0-SNAPSHOT', configuration='default'},changing=false

...

so then I thought I had to manually set changing to true for all snapshots, but when I set

configurations.all {
    resolutionStrategy {
        // don't cache changing modules at all
        cacheChangingModulesFor 0, 'seconds'
    }
}

I noticed that all snapshot dependencies (and only those) were actually checked against the repo where they were found (from the gradle cache).

Cached resource is up-to-date (lastModified: Thu Jun 13 14:39:31 CEST 2013). [HTTP: ...

like image 693
Pelle Avatar asked Nov 18 '25 17:11

Pelle


1 Answers

Yes, this behavior seems to be undocumented but supported for Maven repositories according to a Gradleware engineer:

http://forums.gradle.org/gradle/topics/how_to_get_gradle_to_download_newer_snapshots_to_gradle_cache_when_using_an_ivy_repository#reply_8068039

"If a version number ends in -SNAPSHOT it is implicitly changing when looking for it in a maven repository, because this is a maven convention."

like image 88
Pelle Avatar answered Nov 22 '25 03:11

Pelle



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!