当我明确地调用configurations.customConfig.resolve()
而不是afterResolve
被调用时,否则它永远不会发生。由于我告诉Gradle不要缓存更改的模块,我假设每次都会调用afterResolve
。即使我手动清理Gradle的缓存afterResolve
也不会被调用。为什么呢?
configurations {
customConfig
}
dependencies {
customConfig('org.foo:foo:1.0') {
changing = true
}
}
configurations.customConfig {
//make sure it will be resolved every time
resolutionStrategy {
cacheChangingModulesFor 0, 'seconds'
}
incoming.afterResolve {
//never called
}
}