asciidoctor / asciidoctor-gradle-plugin

A Gradle plugin that uses Asciidoctor via JRuby to process AsciiDoc source files within the project.
https://asciidoctor.github.io/asciidoctor-gradle-plugin/
Apache License 2.0
286 stars 122 forks source link

Supplying closures to asciidoctorj.docExtensions causes execution issues #697

Closed ysb33r closed 10 months ago

ysb33r commented 10 months ago

On Gradle 8.1 and beyond, supplying closures to asciidoctorj.docExtensions can cause execution failures after serialization. This happens in all execution modes. The reported on Gradle 8.4 & 8.5 is slightly different to Gradle 8.1 - 8.3.

A typical error on 8.1 is

Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/io/FilesKt
    at org.gradle.internal.classpath.Instrumented.<clinit>(Instrumented.java:415)
    at build_e3ecf40q8yogg0n3jpm9b3wuf$_run_closure2$_closure6$_closure7.$instrumentedCallSiteArray(build.gradle)
       ...
    at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.registerExtensions(AsciidoctorJavaExec.groovy:116)
    at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.access$0(AsciidoctorJavaExec.groovy)
    at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_run_closure2.doCall(AsciidoctorJavaExec.groovy:64)
    at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_run_closure2.call(AsciidoctorJavaExec.groovy)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2357)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2342)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2383)
    at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.run(AsciidoctorJavaExec.groovy:62)
    at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.main(AsciidoctorJavaExec.groovy:49)

And on 8.5

Exception in thread "main" java.lang.BootstrapMethodError: java.lang.IllegalAccessError: no such constructor: org.gradle.internal.classpath.DefaultInstrumentedClosuresTracker.<init>()void/newInvokeSpecial
    at org.gradle.internal.classpath.InstrumentedClosuresHelper.<clinit>(InstrumentedClosuresHelper.java:36)
    at build_9r2047bfh9khahahter8hejz1$_run_closure2$_closure6$_closure7.doCall(/build.gradle)
       ...
    at org.asciidoctor.groovydsl.AsciidoctorExtensions.registerExtensionsWith(AsciidoctorExtensions.groovy:87)
        ...
    at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.registerExtensions(AsciidoctorJavaExec.groovy:116)
    at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.access$0(AsciidoctorJavaExec.groovy)
    at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_run_closure2.doCall(AsciidoctorJavaExec.groovy:64)
    at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_run_closure2.call(AsciidoctorJavaExec.groovy)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2357)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2342)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2383)
    at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.run(AsciidoctorJavaExec.groovy:62)
    at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.main(AsciidoctorJavaExec.groovy:49)
Caused by: java.lang.IllegalAccessError: no such constructor: org.gradle.internal.classpath.DefaultInstrumentedClosuresTracker.<init>()void/newInvokeSpecial
    at java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(MethodHandleNatives.java:483)
    ...
Caused by: java.lang.NoClassDefFoundError: it/unimi/dsi/fastutil/objects/Object2IntMap