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

Task asciidoctor fails when having more than one backend #324

Closed
mariogarcia opened this issue Apr 4, 2019 · 4 comments
Closed

Task asciidoctor fails when having more than one backend #324

mariogarcia opened this issue Apr 4, 2019 · 4 comments
Labels
2.x Issue related to the 2.x series bug question
Milestone

Comments

@mariogarcia
Copy link

Description

When configuring multiple backends ./gradlew ascii fails even though executing asciiEpub, asciiPdf separately works.

Screenshot

asciidoctor_gradle_exception

Source code

The build.gradle looks like this:

plugins {
    id 'org.asciidoctor.jvm.pdf' version '2.0.0'
    id 'org.asciidoctor.jvm.epub' version '2.0.0'
    id 'org.asciidoctor.jvm.convert' version '2.0.0'
}

repositories {
    jcenter()
    mavenCentral()
}

asciidoctorEpub {
    ebookFormats = [EPUB3]

    sourceDir = 'src/docs/asciidoc'
    sources {
        include 'index.adoc'
    }
}

asciidoctorPdf {
    sourceDir = 'src/docs/asciidoc'
    sources {
        include 'index.adoc'
    }
}

asciidoctor {
    sourceDir = 'src/docs/asciidoc'

    outputOptions {
        backends = ['html5', 'pdf', 'epub'] // <--- ArrayIndexOutOfBoundsException
    }

    sources {
        include 'index.adoc'
    }
}

Anyway you can find the whole project here: https://github.com/mariogarcia/asciidoctor-gradle-samples/tree/master/multiple-backends

Versions

  • Gradle: 5.0
  • JDK: 8.0.191-oracle
@jagedn
Copy link
Contributor

jagedn commented Apr 4, 2019

maybe related with #282

I tried with

outputOptions{
   backends = ['html5', 'epub']
}

and it works

Also I tried to include the epub dependency as suggested in issue 282 using

configurations {
    asciidoctorExt
}
dependencies {
    asciidoctorExt 'org.asciidoctor:asciidoctorj-epub3:1.5.0-alpha.8.1'
}
asciidoctor{     
     ....
     configurations 'asciidoctorExt'
}

but error persists

@ysb33r
Copy link
Member

ysb33r commented Apr 4, 2019

backends = ['html5', 'pdf', 'epub']

@mariogarcia I'll have a look to see what the cause of the ArrayIndexOutOfBoundsException is.

Besides that: It is recommended to use the asciidoctorEpub task instead. If you plan to use the epub backend directly on the generic asciidoctor task it is you responsibility to place the epub artifact on the classpath. The correct way for that is to do

asciidoctor {
  asciidoctorj {
      epubVersion = '1.5.0-alpha.8.1'
  }
}

Do not use the configurations property for that. In addition the epub plugin will ensure that kindlegen is available when using the KF8 eBookFormat.

@jagedn Please note that #282 is related to 1.5.x and not applicable in this case.

@ysb33r ysb33r added the 2.x Issue related to the 2.x series label Apr 4, 2019
@ysb33r
Copy link
Member

ysb33r commented Apr 11, 2019

@mariogarcia You accidentally found a bug that is not really related to your usage. If there are more than two backends specified and there are no additional GEMs, then it causes the ArrayIndexOutOfBoundsException.

I'll fix that and then close this issue and the correct usage have been addressed in https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues?q=is%3Aopen+is%3Aissue+label%3A2.0.x#issuecomment-479826956.

ysb33r added a commit to ysb33r/asciidoctor-gradle-plugin that referenced this issue Apr 11, 2019
When running in JAVA_EXEC mode with three or more backends, but
no additional GEMs specified, the system failed with
`ArrayIndexOutOfBoundsException`. The reason was that `::` was
passed down to AsciidoctorJ as the GEM path. The solution is
not to add empty GEM paths to the GEM search path.
ysb33r added a commit to ysb33r/asciidoctor-gradle-plugin that referenced this issue Apr 11, 2019
When running in JAVA_EXEC mode with three or more backends, but
no additional GEMs specified, the system failed with
`ArrayIndexOutOfBoundsException`. The reason was that `::` was
passed down to AsciidoctorJ as the GEM path. The solution is
not to add empty GEM paths to the GEM search path.
ysb33r added a commit to ysb33r/asciidoctor-gradle-plugin that referenced this issue Apr 11, 2019
When running in JAVA_EXEC mode with three or more backends, but
no additional GEMs specified, the system failed with
`ArrayIndexOutOfBoundsException`. The reason was that `::` was
passed down to AsciidoctorJ as the GEM path. The solution is
not to add empty GEM paths to the GEM search path.
ysb33r added a commit to ysb33r/asciidoctor-gradle-plugin that referenced this issue Apr 11, 2019
When running in JAVA_EXEC mode with three or more backends, but
no additional GEMs specified, the system failed with
`ArrayIndexOutOfBoundsException`. The reason was that `::` was
passed down to AsciidoctorJ as the GEM path. The solution is
not to add empty GEM paths to the GEM search path.
ysb33r added a commit that referenced this issue Apr 11, 2019
Do not add empty GEM paths for multiple backends (#324)
@ysb33r ysb33r mentioned this issue Apr 11, 2019
@ysb33r ysb33r added this to the 2.1.0 milestone Apr 11, 2019
@mariogarcia
Copy link
Author

Understood @ysb33r 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Issue related to the 2.x series bug question
Projects
None yet
Development

No branches or pull requests

4 participants