Gradle配置缓存在本地机器上工作,但在GitHub操作上失败

6rqinv9w  于 12个月前  发布在  Git
关注(0)|答案(2)|浏览(194)

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服务器上的配置缓存?)

siotufzp

siotufzp1#

我还不知道原因。
我目前的解决方法是在CI构建中禁用配置缓存,并将选项--no-configuration-cache添加到所有gradle命令中,例如

./gradlew test --no-configuration-cache

字符串
这将覆盖gradle.properties的设置。

l3zydbqr

l3zydbqr2#

同样,配置缓存在jenkins管道中失败,在本地工作正常。
参见this comment,它很有帮助。它将错误更改为警告,让它忽略配置缓存中的问题(仅当它失败时)并将其存储
控制台输出:

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.
....
...

BUILD SUCCESSFUL in 4m 56s
1779 actionable tasks: 715 executed, 1062 from cache, 2 up-to-date
Configuration cache entry stored with 3 problems.

字符串
我会更新它的影响,如果有任何。

相关问题