gradle / kotlin-dsl-conventions

Gradle Kotlin DSL conventional plugins
Other
26 stars 6 forks source link

plugin seems to be incompatible with latest ktLint version #4

Open abendt opened 2 years ago

abendt commented 2 years ago

we configure the plugin like this:

ktlint {
    disabledRules.set(
        setOf(
            "import-ordering",
            "gradle-kotlin-dsl:gradle-kotlin-dsl-blank-lines",
            "gradle-kotlin-dsl:gradle-kotlin-dsl-imports",
            "gradle-kotlin-dsl:visibility-modifiers-own-line"
        )
    )
    version.set(libs.versions.ktlint)
    verbose.set(true)
}

currently we use ktlint version: "0.43.2", when trying to update this to e.g. "0.45.0" we get the following error:

$ gw ktLintFormat --stacktrace

-----------
* What went wrong:
Execution failed for task ':backend:runKtlintFormatOverTestSourceSet'.
> A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction
   > 'void com.pinterest.ktlint.core.Rule.<init>(java.lang.String)'

...

Caused by: java.lang.NoSuchMethodError: 'void com.pinterest.ktlint.core.Rule.<init>(java.lang.String)'
        at com.pinterest.ktlint.ruleset.standard.CommentSpacingRule.<init>(CommentSpacingRule.kt:11)
        at org.gradle.kotlin.dsl.ktlint.ruleset.GradleKotlinDslRuleSetProvider.get(GradleKotlinDslRuleSetProvider.kt:48)
        at org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction.loadRuleSetsFromClasspath(KtLintWorkAction.kt:106)
        at org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction.loadRuleSetsAndFilterThem(KtLintWorkAction.kt:95)
        at org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction.execute(KtLintWorkAction.kt:20)
David-Requejo commented 2 years ago

I encountered the same problem. Upgrading the Kotlin and ktlint versions for our custom rules worked for me, but that required some effort due to deprecations, breaking changes on 0.45, and new rules

eskatos commented 8 months ago