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

标签 gradle gradle-plugin gradle-cache

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

Task output caching is enabled, but no build caches are configured or enabled



我想念什么?

最佳答案

当启用了构建缓存但为both the local and remote caches are disabled时,将记录此警告。

您是否无意中以某种方式禁用了它们,例如通过某些isCiServer逻辑无法按预期工作?您可以共享buildCache配置吗?

将以下内容添加到settings.gradle中(使用适合您的缓存实例的url):

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

命令行应该足以使构建缓存正常工作。

关于gradle - 任务输出缓存已启用,但未配置或启用任何构建缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50245273/

相关文章:

安卓工作室 "Current NDK support is deprecated"

android - 如何为我的 Android 应用程序定义辅助 ABI

android - 针对 Android gradle 构建工具 3.3.0 构建时关于 bundle 的 Kotlin 运行时库的警告

gradle - 如何使Intellij IDEA使用并行和Gradle构建缓存进行构建

android - 如何使用 Android Studio 运行单元测试

gradle - 截至2018-06年,AspectJ是否有正式的Gradle插件?

gradle - 如何使用 Kotlin 将导入的插件整合到 Gradle 中的自定义插件

gradle - 在 Teamcity CI 代理中重用 Gradle 缓存

gradle - gradle任务构建已经存在问题