-
Notifications
You must be signed in to change notification settings - Fork 17
Description
asciidoctorj-pdf not working with Java 17/21.
I'm trying to use asciidoctorj-pdf along with the Maven Plugin, and while it works with Java 11, it does not when I switch to Java 17 or 21.
I'm getting the following error:
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
As follows, my pom.xml file. This one works perfectly well with Java 11, but fail with Java 21 (for example)
<?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>
<!-- Use version 1.0.1 with Java 11, use 2.0.0 with Java 21-->
<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.
For reference, this is the same issue reported at asciidoctor/asciidoctor-maven-examples#141