Running AsciidoctorJ with Spring Boot

Due to Spring Boot’s packaging system, Asciidoctorj won’t work out of the box from a single JAR application. Luckily Spring Boot plugins for Gradle and Maven provide options to fix it.

Gradle configuration

You just need to add the following configuration to your Gradle build.

bootJar {
	requiresUnpack '**/asciidoctorj-*.jar'
}

For full details, check the official Spring Boot Gradle Plugin documentation.

Maven configuration

Similarly, for the Maven plugin add the following configuration to your POM.

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <requiresUnpack>
            <dependency>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctorj</artifactId>
            </dependency>
        </requiresUnpack>
    </configuration>
</plugin>

For full details, check the official Spring Boot Maven Plugin documentation.