The origin of this is the development of Asciidoctor plugins 2.x. The plugins are all written in Groovy and all of the integration tests with TestKit sofar uses the Groovy DSL. I am now trying to add in integration tests which creates and executes builds using the Kotlin DSL. However I am getting these showstopper errors:
Condition not satisfied: result.output.contains('ERROR: The following messages from AsciidoctorJ are treated as errors') | | | | | false | | FAILURE: Build failed with an exception. | | * What went wrong: | Could not initialize class org.gradle.kotlin.dsl.provider.plugins.DefaultProjectSchemaProviderKt | | * Try: | Run with --info or --debug option to get more log output. Run with --scan to get full insights. | | * Exception is: | java.lang.NoClassDefFoundError: Could not initialize class org.gradle.kotlin.dsl.provider.plugins.DefaultProjectSchemaProviderKt | at org.gradle.kotlin.dsl.provider.plugins.DefaultProjectSchemaProvider.schemaFor(DefaultProjectSchemaProvider.kt:35) | at org.gradle.kotlin.dsl.accessors.AccessorsClassPathKt.schemaFor(AccessorsClassPath.kt:127) | at org.gradle.kotlin.dsl.accessors.AccessorsClassPathKt.jitProjectSchemaOf(AccessorsClassPath.kt:104)
I suspected this missing
org.gradle.kotlin.dsl.provider.plugins.DefaultProjectSchemaProviderKt was simply due to the Kotlin JARs not being in the classpath manifest. (Unlike just adding
localGroovy to the appropriate configuration I have not come across something similar for Kotlin).
In a trivial plugin project with only main & test, I can get it to work, but something as complex as Asciidoctor with multiple layers of testing so far I had no luck with getting Kotlin DSL to work with TestKit.