How to define the Kotlin version for both buildSrc and an application module?

The only way I'm aware of is putting it into gradle.properties (or any other config) and reading it in settings.gradle.kts pluginManagement. Like this:

pluginManagement {
    repositories {
        gradlePluginPortal()
    }
    resolutionStrategy {
        eachPlugin {
            if (requested.id.id.startsWith("org.jetbrains.kotlin")) {
                useVersion(gradle.rootProject.extra["kotlin.version"] as String)
            }
        }
    }
}

Each Gradle release is meant to be used with a specific version of the kotlin-dsl plugin and compatibility between arbitrary Gradle releases and kotlin-dsl plugin versions is not guaranteed.

Using an unexpected version of the kotlin-dsl plugin in a build can cause hard to diagnose problems.

Starting with Gradle 5.4, a warning is emitted whenever an unexpected version of the kotlin-dsl plugin is detected.

Paul Merlin @eskatos, 25.04.2019

Therefore, I removed the version:

plugins {
    `kotlin-dsl`
}

repositories {
    mavenCentral()
}