The asciidoctor-maven-plugin is the official means of using Asciidoctor to render all your AsciiDoc documentation using Apache Maven.
As this is a typical Maven plugin, there isn’t much to do to use it, simply add it to your plugins section in your pom:
...
<plugins>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>${asciidoctor.version}</version> (1)
...
</plugin>
</plugins>
...
-
As this plugin tracks the version of asciidoctor, you can use which every version of asciidoctor you prefer
...
<plugin>
...
<executions>
<execution>
<id>output-html</id> (1)
<phase>generate-resources</phase> (2)
</execution>
</executions>
...
</plugin>
...
-
This is simply an unique id for the execution
-
The asciidoctor-maven-plugin does not run in a specific phase, so one must be specified
Currently there are only three configuration options that the asciidoctor-maven-plugin uses:
-
sourceDir — defaults to
${basedir}/src/main/asciidoc
-
outputDir — defaults to
${project.build.directory}/generated-docs
-
backend — defaults to
docbook
More will be added in the future to take advantage of other options and attributes of Asciidoctor.
These settings can all be changed in the <configuration>
section of the plugin section:
<plugin>
...
</executions>
<configuration>
<sourceDir>src/main/doc</sourceDir>
<outputDir>target/docs</outputDir>
<backend>html</backend>
</configuration>
...
</plugin>
...