Applying a plugin version inside a convention plugin

I had to do this exact thing.

buildSrc/build.gradle.kts needs to have the Maven dependencies of the plugins instead of the ID:

plugins {
    `kotlin-dsl`
}

dependencies {
    implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
}

// Not sure if this is necessary or not
// Add it if it is not able to find the dependencies
repositories {
    gradlePluginPortal()
}

Then in your convention plugin, you just omit the version.

You can find the correct Maven dependency in the legacy section of the plugin page:

https://plugins.gradle.org/plugin/org.jetbrains.kotlin.jvm