Kotlin DSL: how can I use properties in plugin version?

I am a beginner in gradle and in kotlin-dsl, after working ten years in maven. If I define a property I can use it in the application dependencies but not in the plugins. Example:
val kotlinVersion=“1.3.20”
plugins { id(“org.jetbrains.kotlin.jvm”).version.(kotlinVersion) //wrong
implementation(“org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion”) // ok
How can I use a property both for plugin and dependency versions, as in a pom ?


I dont think you can use a property like the way you described. There seems to be an open issue to support this in future.

However there is an article which says you can do so from your setting.gradle file

Yes, you are right. I tried the workaround suggested on issue #480 , modify settings.gradle.kts and omit plugin version in build.gradle.kts, and it works perfectly.
Thank you.