This is a simple Maven plugin allowing you to validate external (and internal) links within your DocBook based documentation. The plugin will look for <link> and <olink> elements and will handle them accordingly:
role
(in the format of targetdoc#targetptr), the plugin will first look up all the xml:id attributes throughout the document. If the targetdoc exists and has the references targetptr, then the olink was valid.Since version 2.0.0 the plugin also validates olinks stored in <olink> XML elements. The targetdoc and targetptr attributes must be present for such elements for the validation to work correctly.
In the pom.xml file you need to add the following section to the build-plugins list:
<plugin>
<groupId>org.forgerock.maven.plugins</groupId>
<artifactId>linktester-maven-plugin</artifactId>
<version>2.0.0-SNAPSHOT</version>
<inherited>false</inherited>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
<phase>pre-site</phase>
</execution>
</executions>
<configuration>
<docSources>
<docSource>
<directory>${basedir}/src/main/docbkx</directory>
<includes>
<include>**/index.xml</include>
</includes>
<excludes>
<exclude>**/not-this-one.xml</exclude>
</excludes>
</docSource>
</docSources>
<validating>false</validating>
<xIncludeAware>true</xIncludeAware>
<failOnError>false</failOnError>
<skipUrls>false</skipUrls>
<skipOlinks>false</skipOlinks>
<skipUrlPatterns>
<skipUrlPattern>^https://bugster.forgerock.org/jira/browse/OPEN(AM|ICF|IDM|IG|DJ)-[0-9]{1,4}$</skipUrlPattern>
</skipUrlPatterns>
<outputFile>linktester.err</outputFile>
</configuration>
</plugin>
This will bind the plugin invocation to the pre-site phase. About the configuration options:
${basedir}
.directory
. When xIncludeAware
is used only include the books.directory
. When xIncludeAware
is not used, it is recommended to exclude the books (and/or disable validation).docSources
(i.e. exclude the individual chapters).By setting the execution in the pom.xml the plugin will be invoked during the build, but if you only want to execute the plugin every now and then, you can use the following command:
mvn org.forgerock.maven.plugins:linktester-maven-plugin:2.0.0-SNAPSHOT:check
To check out the plugin's help, run:
mvn org.forgerock.maven.plugins:linktester-maven-plugin:2.0.0-SNAPSHOT:help
Everything in this repo is licensed under the ForgeRock CDDL license: http://forgerock.org/license/CDDLv1.0.html