I have a Gradle plugin and a dependency that are on the same release cadence and use the same version number. Thus, I want to define a single variable that would hold a version number to be used by both a plugin and a version:
buildscript {
ext.kotlinVersion = '1.6.0'
}
plugins {
id "org.jetbrains.kotlin.jvm" version "$kotlinVersion"
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-reflect:1.6.0"
}
The kotlinVersion variable defined inside the buildscript code block can be used only for plugins and not for dependencies.
Is it possible to use the same variable for both a plugin and a dependency?