You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When I tried to bump gradle to 8.5, asciidoctor gradle plugin came across the following error.
Could you tell me how to fix or workaround? Thanks in advance.
Error: Exception in thread "main" java.io.InvalidClassException: precompiled_OrgApacheGroovyAsciidoctor$_run_closure5$_closure20; local class incompatible: stream classdesc serialVersionUID = 4477335110646737576, local class serialVersionUID = -4624[195](https://github.com/apache/groovy/actions/runs/7303097289/job/19910219335#step:6:196)846785189806
at java.base/java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:597)
at java.base/java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:[205](https://github.com/apache/groovy/actions/runs/7303097289/job/19910219335#step:6:206)1)
at java.base/java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1898)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:[222](https://github.com/apache/groovy/actions/runs/7303097289/job/19910219335#step:6:223)4)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:509)
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:467)
at java.base/java.util.ArrayList.readObject(ArrayList.java:899)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1100)
at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2423)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:[225](https://github.com/apache/groovy/actions/runs/7303097289/job/19910219335#step:6:226)7)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
at java.base/java.io.ObjectInputStream$FieldValues.<init>(ObjectInputStream.java:2606)
at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2457)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2257)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:509)
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:467)
at java.base/java.util.ArrayList.readObject(ArrayList.java:899)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1100)
at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2423)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2257)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
at java.base/java.io.ObjectInputStream$FieldValues.<init>(ObjectInputStream.java:2606)
at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2457)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2257)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:509)
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:467)
at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_main_closure1$_closure7.doCall(AsciidoctorJavaExec.groovy:45)
at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_main_closure1$_closure7.call(AsciidoctorJavaExec.groovy)
at org.codehaus.groovy.runtime.IOGroovyMethods.withCloseable(IOGroovyMethods.java:1607)
at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_main_closure1.doCall(AsciidoctorJavaExec.groovy:44)
at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_main_closure1.call(AsciidoctorJavaExec.groovy)
at org.codehaus.groovy.runtime.IOGroovyMethods.withStream(IOGroovyMethods.java:1184)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.withInputStream(ResourceGroovyMethods.java:1882)
at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.main(AsciidoctorJavaExec.groovy:43)
> Task :groovy-ant:asciidoctor FAILED
> Task :groovy-binary:distSrc
Error: Exception in thread "main" java.io.InvalidClassException: precompiled_OrgApacheGroovyAsciidoctor$_run_closure4$_closure19; local class incompatible: stream classdesc serialVersionUID = 1251694026305095019, local class serialVersionUID = -6305391430266673269
at java.base/java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:597)
at java.base/java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:2051)
at java.base/java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1898)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2224)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:509)
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:467)
at java.base/java.util.ArrayList.readObject(ArrayList.java:899)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1100)
at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:[242](https://github.com/apache/groovy/actions/runs/7424783243/job/20205107427#step:6:243)3)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2257)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
at java.base/java.io.ObjectInputStream$FieldValues.<init>(ObjectInputStream.java:2606)
at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:[245](https://github.com/apache/groovy/actions/runs/7424783243/job/20205107427#step:6:246)7)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2257)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:509)
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:467)
at java.base/java.util.ArrayList.readObject(ArrayList.java:899)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1100)
at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2423)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2[257](https://github.com/apache/groovy/actions/runs/7424783243/job/20205107427#step:6:258))
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
at java.base/java.io.ObjectInputStream$FieldValues.<init>(ObjectInputStream.java:2606)
at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2457)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2257)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1733)
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:509)
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:467)
at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_main_closure1$_closure6.doCall(AsciidoctorJavaExec.groovy:45)
at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_main_closure1$_closure6.call(AsciidoctorJavaExec.groovy)
at org.codehaus.groovy.runtime.IOGroovyMethods.withCloseable(IOGroovyMethods.java:1607)
at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_main_closure1.doCall(AsciidoctorJavaExec.groovy:44)
at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_main_closure1.call(AsciidoctorJavaExec.groovy)
at org.codehaus.groovy.runtime.IOGroovyMethods.withStream(IOGroovyMethods.java:1184)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.withInputStream(ResourceGroovyMethods.java:1882)
at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.main(AsciidoctorJavaExec.groovy:43)
> Task :groovy-ant:asciidoctor
> Task :groovy-ant:asciidoctor FAILED
The reason will be displayed to describe this comment to others. Learn more.
@daniellansun I managed to reproduce locally with JDK17 & Gradle 8.5. (I notice it does work on Gradle 8.1). I'll do some digging to see if I can see what I can discover that the issue is,
docExtensions will cause the dehydration and serialization of that closure. The issue actually happens during the serialization process.
The issue starts with Gradle 8.4. It cannot be the version of Groovy, because 3.0.17 is present in both 8.3 & 8.4. It is possible that there has been a slight change in how Gradle handles something here. At this point I don't know what.
The reason will be displayed to describe this comment to others. Learn more.
@ysb33r Thanks a lot for your looking into the issue 🙂
docExtensions will cause the dehydration and serialization of that closure. The issue actually happens during the serialization process.
The issue starts with Gradle 8.4.
@blindpirate Do you have any idea to workaround the serialization issue? /cc @melix
The reason will be displayed to describe this comment to others. Learn more.
There is a workaround though.
If you put the extensions in a subproject, you can add the project dependecy to docExtensions. That would prevent Gradle from instrumenting the closures.
In concept you can do this
asciidoctor-extensions/build.gradle
plugins {
id 'groovy'
}
dependencies {
compileOnly "org.codehaus.groovy:groovy:1.2.3.4"// As this is the Groovy project, you'll know best how to provide this dependency
compileOnly "org.asciidoctor:asciidoctorj:2.5.7"// Decide which which version of asciidoctorj to use
compileOnly "org.asciidoctor:asciidoctorj-groovy-dsl:2.0.2"
}
The reason will be displayed to describe this comment to others. Learn more.
Great!
This work has lead to some improvements in Asciidoctor Glradle plugin. We'll probably release a 4.0.1 shortly, which will remove the need to use .toString(). However we'll probably not support closure-based extensions on Gradle 8.4+ any time soon. The fix for that is too tricky.
6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ysb33r @aalmiray
When I tried to bump gradle to 8.5, asciidoctor gradle plugin came across the following error.
Could you tell me how to fix or workaround? Thanks in advance.
/cc @paulk-asert @melix @Goooler
6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea about this, I'll try to adopt asciidoctor-gradle-plugin for Gradle 8.
6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Known issue:
asciidoctor/asciidoctor-gradle-plugin#664
Also to potentially clean up:
https://github.com/apache/groovy/blob/master/build-logic/src/main/groovy/org.apache.groovy-asciidoctor.gradle#L42-L46
6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am working on trying to have
asciidoctor-gradle
4.0 (not the alpha version) ready for release by EOW.The existing code base is not Gradle 8 compatible and there are many things that still need testing.
6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be there soon: asciidoctor/asciidoctor-gradle-plugin#662
6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ysb33r I bumped asciidoctor gradle plugin to 4.0.0( cb332ef ), but the issue still happened( https://github.com/apache/groovy/actions/runs/7424783243/job/20205107427#step:6:243 ), could you take a look?
6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daniellansun I ran
:groovy-ant:asciidoctor
locally and it passes.FYI this is the build I had
I wonder if this is a GH Actions env issue.
6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ysb33r I'm trying to bump Gradle to 8.5, but task
:groovy-ant:asciidoctor
always fail even if asciidoctor gradle plugin is 4.0.0 now.6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daniellansun I managed to reproduce locally with JDK17 & Gradle 8.5. (I notice it does work on Gradle 8.1). I'll do some digging to see if I can see what I can discover that the issue is,
6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daniellansun As I don't know the Groovy build, can yopu tell me whether somewhere you declare some asciidoctor extensions using closures?
6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I have gathered so far.
It seems to be related to
./build-logic/src/main/groovy/org.apache.groovy-asciidoctor.gradle
, possible this block of codedocExtensions
will cause the dehydration and serialization of that closure. The issue actually happens during the serialization process.The issue starts with Gradle 8.4. It cannot be the version of Groovy, because 3.0.17 is present in both 8.3 & 8.4. It is possible that there has been a slight change in how Gradle handles something here. At this point I don't know what.
6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ysb33r Thanks a lot for your looking into the issue 🙂
@blindpirate Do you have any idea to workaround the serialization issue? /cc @melix
6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To add more context, I added that
docExtensions
snippet to a test in theasciidoctor-gradle
and the serialization issues does not occur.6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a workaround though.
If you put the extensions in a subproject, you can add the project dependecy to docExtensions. That would prevent Gradle from instrumenting the closures.
In concept you can do this
asciidoctor-extensions/build.gradle
./build-logic/src/main/groovy/org.apache.groovy-asciidoctor.gradle
6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ysb33r
I have not fully understood, but I am trying to fix the build according to your suggestion:
6aaa012
6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daniellansun You should create the extensions as a normal groovy library. Do not place the extensions as a closure in the build script.
See this example subproject https://github.com/asciidoctor/asciidoctor-gradle-plugin/tree/master/jvm/src/gradleTest/extension-in-subproject/extension and then the subproject from which it is used https://github.com/asciidoctor/asciidoctor-gradle-plugin/blob/master/jvm/src/gradleTest/extension-in-subproject/docs-using-project-direct/build.gradle
6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♂️ @daniellansun I completely forgot that it is possible to use a File or a String instance. There is no need to do a subproject.
Just try this
6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ysb33r Thanks a lot for your help! The build is green on my local machine.
Here is the final commit: 31953c2
6e8b11f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
This work has lead to some improvements in Asciidoctor Glradle plugin. We'll probably release a 4.0.1 shortly, which will remove the need to use
.toString()
. However we'll probably not support closure-based extensions on Gradle 8.4+ any time soon. The fix for that is too tricky.