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)
<goals>
<goal>process-asciidoc</goal> (3)
</goals>
</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
-
The (only for the moment) asciidoctor maven plugin goal
Currently there are only three configuration options that the asciidoctor-maven-plugin uses:
-
sourceDirectory — defaults to
${basedir}/src/main/asciidoc
-
outputDirectory — defaults to
${project.build.directory}/generated-docs
-
backend — defaults to
docbook
-
doctype — defaults to
article
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>
<sourceDirectory>src/main/doc</sourceDirectory>
<outputDirectory>target/docs</outputDirectory>
<backend>html</backend>
<doctype>book</doctype>
</configuration>
...
</plugin>
...
Developer setup for hacking on this project isn’t very difficult. The requirements are very small:
-
Java
-
Maven 3
-
Ruby (1.9.x)
-
Bundler
Everything else will be brought in by either Maven or Bundler.
All of the gems for the project must be self contained so they’re included in the final jar. To update the gems in the project, simply issue:
bundle install --path src/main/resources --standalone --clean
from the project root. This will retrieve any new versions since the last install, or Gemfile change, install them into the correct location and clean any unused versions.
http://spockframework.org/(Spock) is used for testing the calling of the jRuby code from the Mojo. This will be downloaded by Maven. Tests are run simply by:
mvn clean test
Or any of the other goals which run tests. If I can figure out a good way to setup a ruby testing environment I’ll do that as well, but none exists at this time.