只想刷新特定的依赖项。
这是我的尝试,但不起作用,寻求一些修改建议
configurations {
snapShotUpdateEveryTime.extendsFrom implementation
}
dependencies {
snapShotUpdateEveryTime 'xxxxxxxxxxxx'
}
configurations.snapShotUpdateEveryTime {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
}
我想你想要:
configurations {
snapShotUpdateEveryTime
implementation.extendsFrom snapShotUpdateEveryTime
}
这样添加到
snapShotUpdateEveryTime
的依赖项就会在 implementation
中被拾取。
您还可以将
snapShotUpdateEveryTime
的所有配置代码放在configurations
块中,这将进一步将其更改为:
configurations {
snapShotUpdateEveryTime {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
}
implementation.extendsFrom snapShotUpdateEveryTime
}
此外,您似乎只关心使用动态版本号声明的依赖项,或者在其版本号中显式声明为快照的依赖项(后者被标记为自动更改(docs))。如果您想在配置中将所有依赖项标记为更改,您可以添加到
snapShotUpdateEveryTime
块:
withDependencies { configureEach { if (it instanceof ExternalModuleDependency) it.changing = true } }