vanniktech/gradle-maven-publish-plugin

Failed to query the value of property 'buildFlowServiceProperty'

jamesward opened this issue · 1 comments

I have a Gradle Plugin project where the plugin is in a subproject, essentially just:

plugins {
    `kotlin-dsl`

    id("com.vanniktech.maven.publish")
}

This results in:

FAILURE: Build failed with an exception.

* What went wrong:
org/jetbrains/kotlin/gradle/plugin/KotlinBasePlugin
> org.jetbrains.kotlin.gradle.plugin.KotlinBasePlugin

The stacktrace includes:

Caused by: java.lang.ClassNotFoundException: org.jetbrains.kotlin.gradle.plugin.KotlinBasePlugin

Maybe I'm setting up the project wrong, but it is strange that everything worked as expected before trying to switch to the com.vanniktech.maven.publish (from maven-publish).

Reproducer project:
https://github.com/jamesward/hello-gradle-plugin

This issue comes from how Gradle classloaders work. You have the plugin with apply false on the root project, so the plugin is added to that class loader. The kotlin-dsl plugin is then added to the subproject and its classloader meaning that the publish plugin isn't able to see it. Adding the following to the root project will fix it.

`kotlin-dsl` apply false

Unfortunately not much we can do about it.