gradle / cookbook

Gradle Cookbook is an open-source collection of recipes, guides and examples for the Gradle Build Tool
https://cookbook.gradle.org/
Other
22 stars 7 forks source link

Why not use a constraint in the Kotlin example? #27

Open CLOVIS-AI opened 1 week ago

CLOVIS-AI commented 1 week ago

Description

In https://cookbook.gradle.org/plugin-development/kotlin-plugins/#making-your-code-compatible-with-the-kotlin-embedded-version there is an elaborate configuration to force a specific version of the Kotlin standard library when writing plugins.

Is there a particular reason dependency constraints can't be used here?

dependencies {
    constraints {
        api("org.jetbrains.kotlin:kotlin-stdlib:$embeddedKotlin")
    }
}

(or something similar, sorry I'm on mobile)

In theory I think this should work?