Composite build plugins DSL unresolved reference

I have a root project including a build from core-build sub-directory. This directory contains extension functions for PluginDependenciesSpecScope.

However, when I call such a function from plugins {} block in the root build.gradle.kts, I get the following error:

build.gradle.kts:8:5: Unresolved reference: jvm

If I use built-in buildSrc functionality, the same thing works. However, I would like to make it work by using this custom composite build.

Here is the code (Gradle v6.4.1):

build.gradle.kts

buildscript {
    dependencies {
        classpath("com.example:core-build")
    }
}

plugins {
    jvm()                 // <- Unresolved reference: jvm
}

settings.gradle.kts

rootProject.name = "example"

includeBuild("core-build")

core-build/build.gradle.kts

group = "com.example"

plugins {
    `kotlin-dsl`
}

repositories {
    jcenter()
}

core-build/src/main/kotlin/Plugins.kt

import org.gradle.kotlin.dsl.PluginDependenciesSpecScope as P
    
fun P.jvm() = kotlin("jvm").version("1.3.72")
1 Like

Did you ever get this working? Iā€™m facing the same problem. Android Studio shows the imports as resolving correctly and I can cmd-click to jump to the implementation, but Gradle gives an ā€œunresolved referenceā€ error.