Using Version Catalogs with Precompiled Script Plugins

Suppose I have a precompiled script plugin which contains something like

plugins {
    // Picking a random plugin out of a hat here
    id("org.jlleitschuh.gradle.ktlint")
}

And suppose in the project I have a version catalog like so:

[plugins]
# Version omitted for the sake of an example
ktlint="org.jlleitschuh.gradle.ktlint"

According to the instructions, I need to declare this plugin as an implementation dependency in order for the precompiled script plugin to function properly. Given the catalog above, how would I populate the dependencies block in my build.gradle.kts?

See

So hopefully in 8.3 there is a built-in way.

In the meantime you can use a manual work-around like

dependencies {
    implementation(libs.plugins.ktlint.dependency)
}

val Provider<PluginDependency>.dependency
    get() = map { "${it.pluginId}:${it.pluginId}.gradle.plugin:${it.version}" }