3

摇篮 1.6。

看起来好像有一个 SNAPSHOT Maven 样式的依赖项将该依赖项标记为在幕后发生变化。那是对的吗?

,如果我通过compile 'com.X.Y:myname:0.1.0-SNAPSHOT'打印依赖项

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

我注意到即使对于 SNAPSHOT 依赖项,更改也会报告为错误:

...

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

...

所以我认为我必须手动将所有快照的更改设置为 true,但是当我设置

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

我注意到所有快照依赖项(并且只有那些)实际上都针对找到它们的存储库(来自 gradle 缓存)进行了检查。

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

4

1 回答 1

3

是的,根据 Gradleware 工程师的说法,这种行为似乎没有记录,但支持 Maven 存储库:

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

“如果版本号以 -SNAPSHOT 结尾,则在 maven 存储库中查找它时会隐式更改,因为这是 maven 约定。”

于 2013-06-18T09:20:17.750 回答