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

Build fails with LoadError when using external GEMs #658

Closed ysb33r closed 7 months ago

ysb33r commented 1 year ago

We see these failures during compatibility testing for asciidoctor-gradle-jvm-gems.

Caching disabled for task ':asciidoctor' because:
  Build cache is disabled
Task ':asciidoctor' is not up-to-date because:
  Executed with '--rerun-tasks'.
Copy resources for 'html5' to /home/schalkc/Projects/asciidoctor-dev/asciidoctor-gradle-plugin-4.x/gems/build/gradleTest/external-gems/7.0.2/build/docs/asciidoc
Running AsciidoctorJ instance with classpath [/tmp/.gradle-test-kit-schalkc/caches/jars-8/o_934e619764059302d1595dd76d4b38e8/asciidoctor-gradle-jvm-4.0.0-alpha.1.jar, .... <snipped>
Successfully started process 'command '~/.sdkman/candidates/java/8.0.292.hs-adpt/bin/java''
Exception in thread "main" org.jruby.exceptions.LoadError: (MissingSpecError) Gem::MissingSpecError
    at RUBY.activate_dependencies(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/specification.rb:1404)
    at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1865)
    at RUBY.activate_dependencies(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/specification.rb:1390)
    at RUBY.activate(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/specification.rb:1372)
    at RUBY.try_activate(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems.rb:221)
    at RUBY.require(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:153)
    at RUBY.<main>(<script>:1)
Caused by: org.jruby.exceptions.LoadError: (MissingSpecVersionError) Gem::MissingSpecVersionError
    at RUBY.to_specs(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/dependency.rb:313)
    at RUBY.activate_dependencies(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/specification.rb:1402)
    ... 6 more
Caused by: org.jruby.exceptions.LoadError: (MissingSpecError) Gem::MissingSpecError
    at RUBY.activate_dependencies(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/specification.rb:1404)
    at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1865)
    at RUBY.activate_dependencies(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/specification.rb:1390)
    at RUBY.activate(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/specification.rb:1372)
    at RUBY.try_activate(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems.rb:215)
    ... 2 more
Caused by: org.jruby.exceptions.LoadError: (MissingSpecVersionError) Gem::MissingSpecVersionError
    at RUBY.to_specs(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/dependency.rb:313)
    at RUBY.activate_dependencies(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/specification.rb:1402)
    ... 6 more
Caused by: org.jruby.exceptions.LoadError: (LoadError) no such file to load -- asciidoctor-bibtex
    at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1017)
    at RUBY.require(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:85)
    ... 1 more
ysb33r commented 1 year ago

There is now an upstream issue for this: https://github.com/asciidoctor/asciidoctorj/issues/1136

dubinsky commented 1 year ago

There is now an upstream issue for this: asciidoctor/asciidoctorj#1136

... which upstream has no plans to work on and says that this is intended behavior since 7 years ago (for me it worked recently and then stopped...). Is there any hope to be able to use asciidoctor-bibtex? Thanks!

tkrah commented 11 months ago

Can you try the workaround from https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/628 - at least the error seems similar.

dubinsky commented 11 months ago

@tkrah

Can you try the workaround from https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/628 - at least the error seems similar.

I did try the workaround, and it did not work for me.

ysb33r commented 7 months ago

I believe I have a solution for this. I just prototyped something for the 4.0 release and it seems to work with bibtex and probably any other GEM that is not already in a JAR.

dubinsky commented 7 months ago

I believe I have a solution for this.

Thanks! Looking forward to it!