https://kotlinlang.org logo
#ktlint
Title
# ktlint
m

Matija Sokol

11/12/2023, 11:42 AM
Is it possible to define ktlint version using value from version catalog?
Copy code
apply plugin: libs.plugins.ktlint.get().getPluginId()

ktlint {
    debug = true
    android = true
    version.set(libs.plugins.ktlint.get().getVersion().toString())
    reporters {
        reporter "html"
        reporter "plain"
    }
}
If I run
./gradlew ktlintFormat
, task execution fails with
Execution failed for task ':app:loadKtlintReporters'.
> Could not resolve all files for configuration ':app:ktlint'.
> Could not find com.pinterest:ktlint:11.5.1.
...
If I hardcode value
version.set("0.50.0")
(or any other version) it works fine.
m

Mario Niebes

11/12/2023, 12:47 PM
The catalog uses 11.5.1, which doesn't exist
m

Matija Sokol

11/12/2023, 12:52 PM
I see now... I accidentally replaced
ktlint
version with
ktlint gradle plugin
version. Thanks for noticing that.
w

wakingrufus

11/13/2023, 8:33 PM
ktlint version and ktlint-gradle plugin version are 2 separate things
4 Views