Skip to content

Latest commit

 

History

History
48 lines (35 loc) · 2.21 KB

File metadata and controls

48 lines (35 loc) · 2.21 KB

Asciidoctor Maven Plugin: Asciidoctor Diagram Example

An example project that demonstrates how to integrate Asciidoctor Diagram with the Asciidoctor Maven plugin.

Usage

Convert the AsciiDoc to HTML5 by invoking the process-resources goal (configured as the default goal):

$ mvn

Open the file target/generated-docs/example-manual.html in your browser to see the generated HTML file containing the generated diagram images.

AsciidoctorJ Diagram integration

AsciidoctorJ Diagram bundles the Asciidoctor Diagram Ruby Gem to ease integration in Java. The example shows how to add it to a Maven build:

  1. Add asciidoctorj-diagram dependency to the Maven Plugin dependencies.

  2. Import the Gem adding the <require>asciidoctor-diagram</require> to Maven Plugin configuration (note the lack of j here).

Graphviz configuration

Asciidoctor Diagram bundles both the ditaa and PlantUML libraries and will use them to generate diagrams. In order to generate diagrams using Graphviz, you must install it separately. There are two options to reference the installed Graphviz’s dot tool in order to generate diagrams: system’s PATH or plug-in attributes configuration.

Configuration via system’s PATH

Visit Graphviz' site for details on how to install the dot command tool, and to make the dot command available on your system’s PATH.

Configuration via plug-in attributes

Once Graphviz binaries from the Graphviz' site are available on the system, the plug-in attributes in the pom.xml can be used to reference to the dot tool directly. This type of configuration may be especially useful when working in a CI environment. Example:

<plugin>
    <groupId>org.asciidoctor</groupId>
    <artifactId>asciidoctor-maven-plugin</artifactId>
    ...
    <configuration>
        <attributes>
            <graphvizdot>/PATH/TO/Graphviz/bin/dot</graphvizdot>
        </attributes>
        ...

References

For more examples and information about Asciidoctor Diagrams see https://asciidoctor.org/news/2014/02/18/plain-text-diagrams-in-asciidoctor/