aldaris / docbook-linktester

Tests external links and olinks in DocBook documentation for validity
3 stars 1 forks source link

DocBook link tester Maven plugin

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:

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.

Sample Configuration

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:

Execution

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

License

Everything in this repo is licensed under the ForgeRock CDDL license: http://forgerock.org/license/CDDLv1.0.html