Upgrading from 9.3.0 to 9.4.0: ktlintCheck fails cause of java.lang.NoSuchFieldError: FUN_KEYWORD
See original GitHub issueWith the upgrade to version 9.4.0
the following exception is thrown with the stacktrace when executing the Gradle Task ktlintCheck
:
Task :ktlintTestSourceSetCheck FAILED
Exception in thread "main" java.lang.NoSuchFieldError: FUN_KEYWORD
at com.pinterest.ktlint.core.ast.ElementType.<clinit>(ElementType.kt:154)
at com.pinterest.ktlint.ruleset.experimental.SpacingAroundAngleBracketsRule.<clinit>(SpacingAroundAngleBracketsRule.kt:94)
at com.pinterest.ktlint.ruleset.experimental.ExperimentalRuleSetProvider.get(ExperimentalRuleSetProvider.kt:18)
at com.pinterest.ktlint.KtlintCommandLine.loadRulesets(Main.kt:550)
at com.pinterest.ktlint.KtlintCommandLine.run(Main.kt:222)
at com.pinterest.ktlint.Main.main(Main.kt:62)
My Environment:
- macOS Catalina Version 10.15.6
- Java: openjdk version “14.0.2” 2020-07-14
- Gradle: 6.1.1
- IntelliJ IDEA 2020.2 (Ultimate Edition) Build #IU-202.6397.94, built on July 27, 2020
This issue occurs within IntelliJ and command line usage.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
ktlintCheck task does not fail on Windows · Issue #399 - GitHub
Kotlin version 1.4.10; Ktlint-gradle plugin 9.4.0. The java --version output in the local and docker environment is the same:.
Read more >kotlin - KtLint check doesn't work locally anymore
For no reason I am able to understand my gradle ktlintCheck command does not yield any issues anymore and :ktlintFormat is not fixing ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Tapchicoma Thank you very much, upgrading all kotlin related stuff to version
1.4.10
solves the problem automatically.In your case it is
id("io.spring.dependency-management") version "1.0.10.RELEASE"
plugin that forces lower kotlin dependency forktlint
configuration. Commenting this plugin allows ktlint to run normally.You could check which kotlin version is used via
./gradlew dependencies --configuration ktlint
.Unfortunately I am not familiar with spring dependency-management plugin to help you with ktlint configuration exclusion.