Skip to content

Instantly share code, notes, and snippets.

@markaltmann
Created March 28, 2020 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markaltmann/8ed5328c291f4b5824122f870295081c to your computer and use it in GitHub Desktop.
Save markaltmann/8ed5328c291f4b5824122f870295081c to your computer and use it in GitHub Desktop.
Maven file for Asciidoc build
<?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>GROUP_ID</groupId>
<artifactId>asciidoc</artifactId>
<version>0.1</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> // Encoding
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<asciidoctor.maven.plugin.version>1.6.0</asciidoctor.maven.plugin.version> // Version of Asciidoctor Maven Plugin
<asciidoctorj.pdf.version>1.5.3</asciidoctorj.pdf.version> // Version of Asciidoctorj PDF Libary
</properties>
<build>
<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>
</dependencies>
<executions>
<!-- Generate PDF -->
<execution>
<id>asciidoc-pdf</id>
<phase>generate-resources</phase> // The phase is like an anchor to start executions from the commandline
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<sourceDirectory>${project.basedir}/src</sourceDirectory>
<sourceDocumentName>${artefactId}.adoc</sourceDocumentName> // You can also leave that empty, then all files in the base directory are rendered. I have one main document here, so i name it.
<outputFile>${project.basedir}/pdf/${artefactId}_${version}.pdf</outputFile>
<backend>pdf</backend>
<sourceHighlighter>coderay</sourceHighlighter>
<!-- Set Attributes -->
<attributes> // You could also insert here the revversion of the Document from an external source. Quite handy...
<!-- <pdf-stylesdir>${project.basedir}/theme</pdf-stylesdir>
<pdf-style>custom</pdf-style> -->
<icons>font</icons>
<toc>left</toc>
<pagenums/>
<sectnums/>
<idprefix/>
<idseparator>-</idseparator>
<revversion>${version}</revversion>
</attributes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment