This was until very recently still true with the Gradle API but was recently fixed. See this issue covering version variables in the Plugin section. There is an open issue for fixing this for the Kotlin DSL.
The only way to get around this is setting the version with a PluginResolutionStrategy as suggested in the same issue in your settings.gradle
:
pluginManagement {
resolutionStrategy {
eachPlugin {
if (requested.version == null) {
def pluginName = requested.id.name.split('-').collect { it.capitalize() }.join().uncapitalize()
def versionPropertyName = (requested.id.id == 'org.jetbrains.kotlin.jvm') ?
"kotlinPluginVersion" : "${pluginName}PluginVersion"
logger.info("Checking for plugin version property '$versionPropertyName'.")
if (gradle.rootProject.hasProperty(versionPropertyName)) {
def version = gradle.rootProject.properties[versionPropertyName]
logger.info("Setting '${requested.id.id}' plugin version to $version.")
useVersion version
} else {
logger.warn("No version specified for plugin '${requested.id.id}' and property " +
"'$versionPropertyName' does not exist.")
}
}
}
}}
And adding a property with the name of the plugin suffixed by "Version" to gradle.properties, e.g. "jacksonVersion".