我发现了--no-build-cache
标志,但是它禁用了远程和本地缓存。
我只需要禁用远程功能。有可能吗?
buildCacheSettings.gradle
buildCache {
local {
enabled = true
}
remote(HttpBuildCache) {
url = 'http://mycache/cache'
}
}
答案 0 :(得分:1)
没有内置命令,但是您可以自己创建。我对我的一个项目有相同的要求,并像这样解决了它:
ext.disableRemoteBuildCache = hasProperty('DISABLE_BUILD_CACHE_REMOTE') || System.getenv().containsKey('DISABLE_BUILD_CACHE_REMOTE')
buildCache {
local(DirectoryBuildCache) {
// ...
}
remote(HttpBuildCache) {
enabled = !disableRemoteBuildCache
// ...
logger.info("Remote build cache configured with enabled: $enabled and url $url")
}
}
然后创建一个名为DISABLE_BUILD_CACHE_REMOTE
的环境变量或使用-PDISABLE_BUILD_CACHE_REMOTE
运行。