gpt4 book ai didi

java - Gradle Ktlint 插件在 Java 16 上失败

转载 作者:行者123 更新时间:2023-12-05 06:48:32 27 4
gpt4 key购买 nike

升级到 Java 16 后,我无法使 ktlint gradle 插件工作。它在 throw

Execution failed for task ':runKtlintCheckOverMainSourceSet'.
A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction
java.lang.ExceptionInInitializerError (no error message)

Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':runKtlintCheckOverMainSourceSet'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$3(ExecuteActionsTaskExecuter.java:186)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:268)

Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction
at org.gradle.workers.internal.DefaultWorkerExecutor$WorkItemExecution.waitForCompletion(DefaultWorkerExecutor.java:336)
at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForItemsAndGatherFailures(DefaultAsyncWorkTracker.java:142)
at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForItemsAndGatherFailures(DefaultAsyncWorkTracker.java:94)
...
Caused by: java.lang.ExceptionInInitializerError
at org.jetbrains.kotlin.com.intellij.pom.java.LanguageLevel.<clinit>(LanguageLevel.java:25)
at org.jetbrains.kotlin.com.intellij.core.CoreLanguageLevelProjectExtension.<init>(CoreLanguageLevelProjectExtension.java:26)
at org.jetbrains.kotlin.com.intellij.core.JavaCoreProjectEnvironment.<init>(JavaCoreProjectEnvironment.java:42)
...
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.util.ResourceBundle.setParent(java.util.ResourceBundle) accessible: module java.base does not "opens java.util" to unnamed module @58f87189
at org.jetbrains.kotlin.com.intellij.util.ReflectionUtil.makeAccessible(ReflectionUtil.java:252)
at org.jetbrains.kotlin.com.intellij.util.ReflectionUtil.getDeclaredMethod(ReflectionUtil.java:269)
at org.jetbrains.kotlin.com.intellij.DynamicBundle.<clinit>(DynamicBundle.java:22)
... 32 more

我知道这是由更严格的模块检查 (JEP 396) 引起的,但我无法为插件设置 JVM args。我试过:

  • 设置环境变量JAVA_OPTS=--illegal-access=warn
  • gradle.properties 中设置 org.gradle.jvmargs=--illegal-access=warn -Dkotlin.daemon.jvm.options=--illegal-access=warn >

但是这两种尝试都没有帮助,我没有想法。

最佳答案

看来Gradle 6.x不支持Java 16,Gradle 7会支持。

关于java - Gradle Ktlint 插件在 Java 16 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66806195/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com