已启用任务输出缓存,但未配置或启用任何构建缓存

时间:2018-05-09 03:53:03

标签: gradle gradle-plugin gradle-cache

我已配置buildCache {}部分并启用了远程缓存,但日志显示

  

启用了任务输出缓存,但未配置或启用任何构建缓存

我错过了什么?

1 个答案:

答案 0 :(得分:0)

启用构建缓存但both the local and remote caches are disabled时会记录此警告。

你是否无意中以某种方式禁用了它们,例如通过一些不按预期工作的isCiServer逻辑?你能分享你的buildCache配置吗?

在settings.gradle中添加以下内容(使用适当的缓存实例网址):

ext.isCiServer = System.getenv().containsKey("CI")

buildCache {
    local {
        enabled = !isCiServer
    }
    remote(HttpBuildCache) {
        url = 'https://example.com:8123/cache/'
        push = isCiServer
    }
}

并添加

org.gradle.caching=true

到您的gradle.properties

--build-cache

到命令行应该足以让构建缓存工作。

相关问题