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

ArrayOutOfBoundsException with multiple backends #282

Closed
kec2 opened this issue Dec 30, 2018 · 2 comments
Closed

ArrayOutOfBoundsException with multiple backends #282

kec2 opened this issue Dec 30, 2018 · 2 comments
Labels
1.[56].x Issues related to the 1.5.x/1.6.x series wontfix

Comments

@kec2
Copy link

kec2 commented Dec 30, 2018

It seams that different combinations of html5, docbook, pdf and epub works and others does not.
This works: backends = ['epub3']
This works: backends = ['html5', docbook]
This does not work: backends = ['html5', 'docbook', 'pdf']
This does not work: backends = ['html5', 'epub3']

This is the exception i get:

gradlew clean asciidoc

> Task :asciidoctor FAILED
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
        at org.asciidoctor.internal.EnvironmentInjector.inject(EnvironmentInjector.java:31)
        at org.asciidoctor.internal.JRubyAsciidoctor.injectEnvironmentVariables(JRubyAsciidoctor.java:187)
        at org.asciidoctor.internal.JRubyAsciidoctor.createJRubyAsciidoctorInstance(JRubyAsciidoctor.java:145)
        at org.asciidoctor.internal.JRubyAsciidoctor.create(JRubyAsciidoctor.java:83)
        at org.asciidoctor.Asciidoctor$Factory.create(Asciidoctor.java:696)
        at org.asciidoctor.gradle.backported.AsciidoctorJavaExec.getAsciidoctorInstance(AsciidoctorJavaExec.groovy:73)
        at org.asciidoctor.gradle.backported.AsciidoctorJavaExec.run(AsciidoctorJavaExec.groovy:39)
        at org.asciidoctor.gradle.backported.AsciidoctorJavaExec.main(AsciidoctorJavaExec.groovy:195)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':asciidoctor'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_191\bin\java.exe'' finished with non-zero exit value 1

This is my build file.

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'org.asciidoctor:asciidoctorj-epub3:1.5.0-alpha.6'
        classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.15'
        classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.9.2'
    }
}

apply plugin: 'org.asciidoctor.convert'
apply plugin: 'java'

repositories {
    jcenter()
}

asciidoctor {
    backends = ['html5', 'docbok', 'pdf', 'epub3']
    options doctype: 'book'
    sources {
        include 'index.adoc'
    }

    attributes \
        'build-gradle': file('build.gradle'),
        'sourcedir': file('src/docs/asciidoc'),
        'endpoint-url': 'http://foo.bar.baz',
        'source-highlighter': 'coderay',
        'imagesdir': 'images',
        'toc': 'left',
        'icons': 'font',
        'setanchors': '',
        'idprefix': '',
        'idseparator': '-'
}

@jjaderberg
Copy link

Looks like not finding asciidoctor-pdf or asciidoctor-epub3 might be the root cause. Do additional dependencies need to be declared to use these backends? I see that asciidoctorj-epub3 was pulled out into its own project a few months ago. Not sure about current status for asciidoctorj-pdf.


I see the same as @kec2 for backends = ['html5', 'docbook', 'pdf'], but this seems only to mask the root cause. Any combination of backend that includes one of 'pdf' or 'epub3' seems to fail, and most of them fail explicitly on Caused by: org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- asciidoctor-pdf or <idem> -- asciidoctor-epub3.

backends 'epub3' or backends = ['epub3']:

Exception in thread "main" org.asciidoctor.gradle.backported.AsciidoctorRemoteExecutionException: Error running Asciidoctor whilst attempting to process /path/to/asciidoc.adoc using backend pdf
        at org.asciidoctor.gradle.backported.AsciidoctorJavaExec$_convertFiles_closure3.doCall(AsciidoctorJavaExec.groovy:63)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:326)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
        at groovy.lang.Closure.call(Closure.java:411)
        at groovy.lang.Closure.call(Closure.java:427)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2296)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2281)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2334)
        at org.asciidoctor.gradle.backported.AsciidoctorJavaExec.convertFiles(AsciidoctorJavaExec.groovy:56)
        at org.asciidoctor.gradle.backported.AsciidoctorJavaExec.access$0(AsciidoctorJavaExec.groovy)
        at org.asciidoctor.gradle.backported.AsciidoctorJavaExec$_run_closure2.doCall(AsciidoctorJavaExec.groovy:50)
        at org.asciidoctor.gradle.backported.AsciidoctorJavaExec$_run_closure2.call(AsciidoctorJavaExec.groovy)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2296)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2281)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2322)
        at org.asciidoctor.gradle.backported.AsciidoctorJavaExec.run(AsciidoctorJavaExec.groovy:48)
        at org.asciidoctor.gradle.backported.AsciidoctorJavaExec.main(AsciidoctorJavaExec.groovy:195)
Caused by: org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- asciidoctor-pdf
        at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:956)
        at RUBY.require(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
        at RUBY.<main>(<script>:1)

backends 'pdf' or backends = ['pdf']:

Exception in thread "main" org.asciidoctor.gradle.backported.AsciidoctorRemoteExecutionException: Error running Asciidoctor whilst attempting to process /path/to/asciidoc.adoc using backend epub3
        at org.asciidoctor.gradle.backported.AsciidoctorJavaExec$_convertFiles_closure3.doCall(AsciidoctorJavaExec.groovy:63)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:326)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
        at groovy.lang.Closure.call(Closure.java:411)
        at groovy.lang.Closure.call(Closure.java:427)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2296)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2281)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2334)
        at org.asciidoctor.gradle.backported.AsciidoctorJavaExec.convertFiles(AsciidoctorJavaExec.groovy:56)
        at org.asciidoctor.gradle.backported.AsciidoctorJavaExec.access$0(AsciidoctorJavaExec.groovy)
        at org.asciidoctor.gradle.backported.AsciidoctorJavaExec$_run_closure2.doCall(AsciidoctorJavaExec.groovy:50)
        at org.asciidoctor.gradle.backported.AsciidoctorJavaExec$_run_closure2.call(AsciidoctorJavaExec.groovy)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2296)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2281)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2322)
        at org.asciidoctor.gradle.backported.AsciidoctorJavaExec.run(AsciidoctorJavaExec.groovy:48)
        at org.asciidoctor.gradle.backported.AsciidoctorJavaExec.main(AsciidoctorJavaExec.groovy:195)
Caused by: org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- asciidoctor-epub3
        at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:956)
        at RUBY.require(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
        at RUBY.<main>(<script>:1)

build.gradle:

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.9.2'
    }
}

apply plugin: 'org.asciidoctor.convert'

asciidoctor {
    // backends 'pdf' // backends = ['pdf']
    backends = ['epub3'] // backends 'epub3'
    logDocuments = true
    sourceDir "asciidoc"
    sources {
        include 'introduction.adoc'
    }
}

@ysb33r
Copy link
Member

ysb33r commented Feb 7, 2019

Use

dependencies {
    asciidoctor 'org.asciidoctor:asciidoctorj-epub3:1.5.0-alpha.6'
    asciidoctor 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.15'
}

instead. This is due to a fix that was introduced to run asciidoctorj out of process in the 1.5.x. The fact that buildscript.classpath worked in previous releases is accidental, not intentional.

@ysb33r ysb33r added the 1.[56].x Issues related to the 1.5.x/1.6.x series label Feb 7, 2019
@ysb33r ysb33r changed the title ArrayOutOfBoundsException with mutiple backends ArrayOutOfBoundsException with multiple backends Feb 7, 2019
@ysb33r ysb33r mentioned this issue Mar 22, 2019
28 tasks
@ysb33r ysb33r added the wontfix label Apr 4, 2019
@ysb33r ysb33r closed this as completed Apr 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.[56].x Issues related to the 1.5.x/1.6.x series wontfix
Projects
None yet
Development

No branches or pull requests

3 participants