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

asciidoctor-epub-example not working with Java17 #141

Open
abelsromero opened this issue Jul 28, 2022 · 2 comments
Open

asciidoctor-epub-example not working with Java17 #141

abelsromero opened this issue Jul 28, 2022 · 2 comments
Labels

Comments

@abelsromero
Copy link
Member

Works fine with Java 11, but with Java17 and no kindlegen fails.

        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <asciidoctor.maven.plugin.version>2.2.2</asciidoctor.maven.plugin.version>
        <asciidoctorj.epub.version>1.5.1</asciidoctorj.epub.version>
        <asciidoctorj.version>2.5.5</asciidoctorj.version>
        <jruby.version>9.3.4.0</jruby.version>

mvn -e

[ERROR] Failed to execute goal org.asciidoctor:asciidoctor-maven-plugin:3.0.0-SNAPSHOT:process-asciidoc (generate-spine-kf8) on project asciidoctor-epub-example: Execution generate-spine-kf8 of goal org.asciidoctor:asciidoctor-maven-plugin:3.0.0-SNAPSHOT:process-asciidoc failed: org.jruby.exceptions.SystemCallError: (EBADF) Bad file descriptor - /bin/sh -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.asciidoctor:asciidoctor-maven-plugin:3.0.0-SNAPSHOT:process-asciidoc (generate-spine-kf8) on project asciidoctor-epub-example: Execution generate-spine-kf8 of goal org.asciidoctor:asciidoctor-maven-plugin:3.0.0-SNAPSHOT:process-asciidoc failed: org.jruby.exceptions.SystemCallError: (EBADF) Bad file descriptor - /bin/sh
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:375)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution generate-spine-kf8 of goal org.asciidoctor:asciidoctor-maven-plugin:3.0.0-SNAPSHOT:process-asciidoc failed: org.jruby.exceptions.SystemCallError: (EBADF) Bad file descriptor - /bin/sh
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.asciidoctor.jruby.internal.AsciidoctorCoreException: org.jruby.exceptions.SystemCallError: (EBADF) Bad file descriptor - /bin/sh
    at org.asciidoctor.jruby.internal.JRubyAsciidoctor.convertFile (JRubyAsciidoctor.java:402)
    at org.asciidoctor.jruby.internal.JRubyAsciidoctor.convertFile (JRubyAsciidoctor.java:368)
    at org.asciidoctor.maven.AsciidoctorMojo.convertFile (AsciidoctorMojo.java:451)
    at org.asciidoctor.maven.AsciidoctorMojo.processSources (AsciidoctorMojo.java:250)
    at org.asciidoctor.maven.AsciidoctorMojo.processAllSources (AsciidoctorMojo.java:166)
    at org.asciidoctor.maven.AsciidoctorMojo.execute (AsciidoctorMojo.java:156)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.jruby.exceptions.SystemCallError: (EBADF) Bad file descriptor - /bin/sh
    at org.jruby.RubyProcess.spawn (org/jruby/RubyProcess.java:1671)
    at org.jruby.RubyKernel.spawn (org/jruby/RubyKernel.java:1723)
    at RUBY.popen_run (uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/open3.rb:213)
    at RUBY.popen3 (uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/open3.rb:101)
    at RUBY.capture3 (uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/open3.rb:281)
    at RUBY.distill_epub_to_mobi (uri:classloader:/gems/asciidoctor-epub3-1.5.1/lib/asciidoctor-epub3/converter.rb:1679)
    at RUBY.write (uri:classloader:/gems/asciidoctor-epub3-1.5.1/lib/asciidoctor-epub3/converter.rb:42)
    at RUBY.write (uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/document.rb:988)
    at RUBY.convert (uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/convert.rb:124)
    at RUBY.convert_file (uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/convert.rb:190)
    at org.jruby.RubyIO.open (org/jruby/RubyIO.java:1148)
    at RUBY.convert_file (uri:classloader:/gems/asciidoctor-2.0.17/lib/asciidoctor/convert.rb:190)
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

@lealceldeiro
Copy link

Hey @abelsromero,
Is there any updates on this issue.

I stumbled upon this while searching for possible causes/solutions for the following error I'm facing:

Execution generate-pdf-doc of goal org.asciidoctor:asciidoctor-maven-plugin:3.1.1:process-asciidoc failed: org.jruby.exceptions.SystemCallError: (EBADF) Bad file descriptor - /usr/bin/gs

This is my pom.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.lealceldeiro</groupId>
  <artifactId>docs</artifactId>
  <version>4.0-SNAPSHOT</version>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>21</maven.compiler.source>
    <maven.compiler.target>21</maven.compiler.target>
    <java.version>21</java.version>

    <asciidoctor.maven.plugin.version>3.1.1</asciidoctor.maven.plugin.version>
    <asciidoctorj.pdf.version>2.3.19</asciidoctorj.pdf.version>
    <asciidoctorj.version>3.0.0</asciidoctorj.version>
    <jruby.version>9.4.9.0</jruby.version>
    <asciidoc-extensions.version>2.0.0</asciidoc-extensions.version>
  </properties>


  <build>
    <!-- Docs: https://docs.asciidoctor.org/maven-tools/latest/-->
    <defaultGoal>compile</defaultGoal>
    <plugins>
      <plugin>
        <groupId>org.asciidoctor</groupId>
        <artifactId>asciidoctor-maven-plugin</artifactId>
        <version>${asciidoctor.maven.plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoctorj-pdf</artifactId>
            <version>${asciidoctorj.pdf.version}</version>
          </dependency>
          <dependency>
            <groupId>org.jruby</groupId>
            <artifactId>jruby</artifactId>
            <version>${jruby.version}</version>
          </dependency>
          <dependency>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoctorj</artifactId>
            <version>${asciidoctorj.version}</version>
          </dependency>
          <dependency>
            <groupId>com.lealceldeiro</groupId>
            <artifactId>asciidoc-extensions</artifactId>
            <version>${asciidoc-extensions.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <sourceDirectory>src/main/resources</sourceDirectory>
          <!-- Attributes common to all output formats -->
          <attributes>
            <imagesdir>assets/images</imagesdir>
            <pdf-fontsdir>src/main/resources/assets/font</pdf-fontsdir>
            <pdf-theme>src/main/resources/my-theme.yml</pdf-theme>
            <sourcedir>${project.build.sourceDirectory}</sourcedir>
          </attributes>
        </configuration>
        <executions>
          <execution>
            <id>generate-pdf-doc</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>process-asciidoc</goal>
            </goals>
            <configuration>
              <backend>pdf</backend>
              <attributes>
                <source-highlighter>rouge</source-highlighter>
              </attributes>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

I'm using Java 21 (17 fails too, while 11 is OK), running on Ubuntu 24 LTS and Maven 3.9.9.

I'm assuming the issue is related to asciidoctorj-pdf because
mvn asciidoctor:process-asciidoc builds and generates the resources (HTML) without issues, but
mvn process-resources (custom execution config bind to use pdf as the backend) is failing.

@abelsromero
Copy link
Member Author

Thanks for the reminder!

Regarding the original epub issue, the project works with modern versions but attributes and kindlegen are no longer applicable.
@slonopotamus can I ask for help here? From looking at the docs (https://docs.asciidoctor.org/epub3-converter/latest/) and code, it seems the recent versions of the project focus on EPUB3 only. Kf8 is no longer a thing and the ebook-format attribute doesn't do much (there's this though 🤔 ❓ ). I recall the conversation about how kindlegen was simply unwelcoming now. So, it's safe to remove kf8 and kindlegen stuff from the maven examples? It seems to me at least.

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

No branches or pull requests

2 participants