Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gems don't work with Gradle >= 8.7 #725

Open
markslater opened this issue Apr 2, 2024 · 7 comments · May be fixed by #726
Open

Gems don't work with Gradle >= 8.7 #725

markslater opened this issue Apr 2, 2024 · 7 comments · May be fixed by #726

Comments

@markslater
Copy link

It seems that the org.asciidoctor.jvm.gems plugin is broken from Gradle 8.7 on, probably because of this bug in grolifant: https://gitlab.com/ysb33rOrg/grolifant/-/issues/137.

Reproducer

Given the following build.gradle.kts:

buildscript {
    repositories {
        mavenCentral()
    }
}

plugins {
    id("org.asciidoctor.jvm.gems") version "4.0.2"
}

repositories {
    mavenCentral()
    ruby {
        gems()
    }
}

dependencies {
    asciidoctorGems("rubygems:asciidoctor-revealjs:5.1.0")
}

Under Gradle 8.6, ./gradlew clean asciidoctorGemsPrepare succeeds, but under Gradle 8.7, it fails with:

exception thrown for request to /rubygems/asciidoctor-revealjs/5.1.0/ivy.xml
java.lang.NoClassDefFoundError: Lorg/gradle/wrapper/ExclusiveFileAccessManager;
        at java.base/java.lang.Class.getDeclaredFields0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3061)
        at java.base/java.lang.Class.getDeclaredFields(Class.java:2248)
        at org.codehaus.groovy.reflection.CachedClass$1.lambda$initValue$2(CachedClass.java:59)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at org.codehaus.groovy.reflection.CachedClass$1.initValue(CachedClass.java:62)
        at org.codehaus.groovy.reflection.CachedClass$1.initValue(CachedClass.java:54)
        at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:50)
        at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:37)
        at org.codehaus.groovy.reflection.CachedClass.getFields(CachedClass.java:256)
        at groovy.lang.MetaClassImpl.addFields(MetaClassImpl.java:2499)
        at groovy.lang.MetaClassImpl.inheritFields(MetaClassImpl.java:2494)
        at groovy.lang.MetaClassImpl.setupProperties(MetaClassImpl.java:2380)
        at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:3421)
        at groovy.lang.MetaClassImpl.reinitialize(MetaClassImpl.java:3395)
        at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3388)
        at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:273)
        at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:315)
        at org.ysb33r.grolifant.api.core.ExclusiveFileAccess.$getStaticMetaClass(ExclusiveFileAccess.groovy)
        at org.ysb33r.grolifant.api.core.ExclusiveFileAccess.<init>(ExclusiveFileAccess.groovy)
        at org.ysb33r.gradle.jruby.internal.core.DefaultIvyXmlFactory.createIvyXml(DefaultIvyXmlFactory.groovy:152)
        at org.ysb33r.gradle.jruby.internal.core.DefaultIvyXmlFactory.ivyXmlPath(DefaultIvyXmlFactory.groovy:87)
        at org.ysb33r.gradle.jruby.internal.resolver.RatpackServerFactory.lambda$null$0(RatpackServerFactory.java:63)
        at ratpack.handling.internal.DefaultContext.next(DefaultContext.java:157)
        at ratpack.handling.internal.MethodHandler.handle(MethodHandler.java:44)
        at ratpack.handling.internal.DefaultContext.next(DefaultContext.java:157)
        at ratpack.handling.internal.DefaultContext.insert(DefaultContext.java:179)
        at ratpack.path.internal.PathHandler.handle(PathHandler.java:61)
        at ratpack.handling.internal.DefaultContext.next(DefaultContext.java:157)
        at ratpack.handling.internal.DefaultContext.lambda$start$4(DefaultContext.java:104)
        at ratpack.exec.internal.DefaultExecution.lambda$new$0(DefaultExecution.java:82)
        at ratpack.exec.internal.DefaultExecution$InitialExecStream.exec(DefaultExecution.java:403)
        at ratpack.exec.internal.DefaultExecution.exec(DefaultExecution.java:224)
        at ratpack.exec.internal.DefaultExecution.exec(DefaultExecution.java:217)
        at ratpack.exec.internal.DefaultExecution.drain(DefaultExecution.java:187)
        at io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38)
        at io.netty.util.concurrent.PromiseTask.run(PromiseTask.java:73)
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:335)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:909)
        at ratpack.exec.internal.DefaultExecController$ExecControllerBindingThreadFactory.lambda$newThread$0(DefaultExecController.java:137)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.ExclusiveFileAccessManager
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
        at org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader.findClass(VisitableURLClassLoader.java:187)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:594)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527)
        ... 44 more
> Task :asciidoctorGemsPrepare FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':asciidoctorGemsPrepare'.
> Could not resolve all files for configuration ':asciidoctorGems'.
   > Could not resolve rubygems:asciidoctor-revealjs:5.1.0.
     Required by:
         project :
      > Could not resolve rubygems:asciidoctor-revealjs:5.1.0.
         > Could not get resource 'http://localhost:38881/rubygems/asciidoctor-revealjs/5.1.0/ivy.xml'.
            > Could not GET 'http://localhost:38881/rubygems/asciidoctor-revealjs/5.1.0/ivy.xml'. Received status code 500 from server: Internal Server Error

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 42s
2 actionable tasks: 2 executed

NB because of the vagaries of Gradle, it can take a little fiddling to make it actually use the 8.7 wrapper after upgrading from 8.6. I found stopping all Gradle daemons with ./gradlew --stop and removing the cache directory and rubygem cache directory (~/.gradle/caches and ~/.gradle/rubygems-ivyxml-cache2 by default) seemed to give it the nudge it needed.

@markslater markslater linked a pull request Apr 17, 2024 that will close this issue
@abelsromero
Copy link
Member

abelsromero commented Apr 17, 2024

I am happy waiting for 8.8 if the issue is located to Gradle 8.7. If I understand correctly, this is for both #725 and #726 right? and the issue is only with Gradle 8.7?

@markslater
Copy link
Author

@abelsromero yes. I'll update the PR when Gradle 8.8 is available.

@abelsromero
Copy link
Member

It's my opinion, other may differ.

markslater added a commit to argo-json/argo that referenced this issue Apr 18, 2024
@ysb33r ysb33r closed this as completed Apr 24, 2024
@ysb33r ysb33r reopened this Apr 24, 2024
@ysb33r
Copy link
Member

ysb33r commented Apr 24, 2024

Bumping the build to the latest version of grolifant should solve this issue

@markslater
Copy link
Author

@ysb33r it does, but an issue with Gradle 8.7 itself causes spurious test failures. I just tested with Gradle 8.8-rc-1, and everything is working.

See #726 for a brief discussion with @abelsromero about how we should deal with it.

@abelsromero
Copy link
Member

I think what @ysb33r is suggesting is that we could bump the version and make a release?

@markslater
Copy link
Author

In that case, I'd suggest taking the current version of #726, which bumps grolifant to the latest version and tests it using 8.8-rc-1. We can then come back and switch the test to the production version of 8.8 when it's released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants