在gradle.properties
中我设置
org.gradle.unsafe.configuration-cache=true
这在我的本地计算机上运行没有错误。输出为:
0 problems were found storing the configuration cache.
当我在 GitHub Actions 上设置作业时,只有停用配置缓存,它才会成功。 当它被激活时,我得到这个日志:
3 problems were found storing the configuration cache, 1 of which seems unique.
- Task `:app:buildKotlinToolingMetadata` of type `org.jetbrains.kotlin.gradle.tooling.BuildKotlinToolingMetadataTask$FromKotlinExtension`: invocation of 'Task.project' at execution time is unsupported.
See https://docs.gradle.org/7.4.2/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
See the complete report at file:///home/runner/work/***/***/build/reports/configuration-cache/3lar58wlvtv9703t0m3olblg9/gwoz69d8l961obatzzelsv4d/configuration-cache-report.html
> Invocation of 'Task.project' by task ':app:buildKotlinToolingMetadata' at execution time is unsupported.
我的主要兴趣是为什么它的行为不同。
我还想知道最好的解决方法是什么。 (可以从缓存中跳过任务吗?或者如何停用 CI 服务器上的配置缓存?)
最佳答案
我还没明白原因。
我当前的解决方法是禁用 CI 构建上的配置缓存,将选项 --no-configuration-cache
添加到所有 gradle 命令中,例如
./gradlew test --no-configuration-cache
这会覆盖 gradle.properties
的设置。
关于android - Gradle 配置缓存在本地计算机上有效,但在 GitHub Actions 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73497571/