-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Labels
Milestone
Description
When writing a Gradle plugin in Groovy with @CompileStatic, referencing AsciidoctorTask causes a compilation error.
The same code in Kotlin only produces a warning.
Steps to Reproduce
Use a classic variant of plugin
dependencies {
implementation("org.asciidoctor.jvm.convert.classic:org.asciidoctor.jvm.convert.classic.gradle.plugin:5.0.0-alpha.1")
...
}
Use @CompileStatic and reference AsciidoctorTask class
package example
import groovy.transform.CompileStatic
import org.asciidoctor.gradle.jvm.AsciidoctorJPlugin
import org.asciidoctor.gradle.jvm.AsciidoctorTask
import org.gradle.api.Plugin
import org.gradle.api.Project
@CompileStatic
class DocumentationPlugin implements Plugin<Project> {
@Override
void apply(Project project) {
project.plugins.apply(AsciidoctorJPlugin)
project.tasks.withType(AsciidoctorTask).configureEach {
it.baseDirFollowsSourceFile()
}
}
}
Run ./gradlew clean check
➜ asc-example ./gradlew clean check
> Task :compileGroovy FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileGroovy'.
> Unrecoverable compilation error: startup failed:
General error during canonicalization: java.lang.NoClassDefFoundError: org.ysb33r.grolifant5.api.remote.worker.SerializableWorkerAppParameters
java.lang.RuntimeException: java.lang.NoClassDefFoundError: org.ysb33r.grolifant5.api.remote.worker.SerializableWorkerAppParameters
at org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:940)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:660)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:634)
A result for a kotlin project
> Task :compileKotlin
DocumentationPlugin.kt:14:16 Cannot access 'SerializableWorkerAppParameters' which is a supertype of 'AbstractAsciidoctorTask' or one of its arguments. This may be forbidden soon. Check the module classpath for missing or conflicting dependencies.