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
285 stars 120 forks source link

Fix gems in gradle 8.7 #726

Closed markslater closed 2 months ago

markslater commented 5 months ago

Fixes #725.

I need some guidance on how the maintainers would like to handle one issue:

I've included a change to the test config that demonstrates the original issue with Gradle 8.7, but with the fix, the Gradle 8.7 tests fail for a different reason, which I suspect is caused by this Gradle 8.7 TestKit bug: https://github.com/gradle/gradle/issues/28729. That TestKit bug is fixed in the upcoming Gradle 8.8-RC1.

I've manually tested my change, and confirmed it fixes the issue.

Three options come to mind:

  1. Remove the Gradle 8.7 tests; the existing tests prove this change doesn't break the plugin for previous versions of Gradle.
  2. Wait for Gradle 8.8-RC1.
  3. Wait for Gradle 8.8.

For reference, the test failures are like this:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/gradle/internal/classpath/InstrumentableClosure
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:757)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
    at java.lang.Class.getMethod0(Class.java:3018)
    at java.lang.Class.getMethod(Class.java:1784)
    at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:670)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:652)
Caused by: java.lang.ClassNotFoundException: org.gradle.internal.classpath.InstrumentableClosure
    at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
    ... 19 more

> Task :asciidoctor FAILED
markslater commented 4 months ago

I've added Gradle 8.8 to the compatibility test matrix to demonstrate the fix.

dubinsky commented 4 months ago

@abelsromero @ysb33r are there any plans to release this so that the plugin could be used with current versions of Gradle? Thank you!

ysb33r commented 2 months ago

@markslater Can you change the target to development-4.x instead of master, please?

ysb33r commented 2 months ago

@markslater Can you change the target to development-4.x instead of master, please?

Never mind. I am going to merge it to master and cherry-pick it back.