maven-plugins/linkcheck/plugin.jelly

95 lines
3.1 KiB
XML

<?xml version="1.0"?>
<project
xmlns:j="jelly:core"
xmlns:define="jelly:define"
xmlns:linkcheck="linkcheck"
xmlns:doc="doc">
<property name="maven.linkcheck.cache" value="${pom.getPluginContext('maven-linkcheck-plugin').getVariable('maven.linkcheck.cache')}"/>
<property name="maven.gen.docs" value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.gen.docs')}"/>
<goal name="maven-linkcheck-plugin:register">
<doc:registerReport
name="Link Check Report"
pluginName="maven-linkcheck-plugin"
link="linkcheck"
description="Report on the validity of all links in the documentation."/>
</goal>
<goal name="maven-linkcheck-plugin:deregister">
<doc:deregisterReport name="Link Check Report"/>
</goal>
<define:taglib uri="linkcheck">
<define:jellybean
name="linkcheck"
className="org.apache.maven.linkcheck.LinkCheck"
method="doExecute"
/>
</define:taglib>
<!-- ================================================================== -->
<!-- C R E A T E L I N K C H E C K X M L R E P O R T -->
<!-- ================================================================== -->
<!-- The reason for the odd goal configuration is this:
We really don't want the link checker to run until everything else is complete
-->
<goal name="maven-linkcheck-plugin:report">
<copy file="${plugin.resources}/linkcheck-temp.xml"
toFile="${maven.gen.docs}/linkcheck.xml"/>
</goal>
<postGoal name="xdoc:jelly-transform">
<j:set var="reports" value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('reports')}"/>
<j:set var="context" value="${pom.getPluginContext('maven-xdoc-plugin')}"/>
<j:set var="online">${maven.mode.online}</j:set>
<j:if test="${online.trim().length() > 0}">
<j:forEach var="report" items="${reports}">
<j:if test="${report.get('pluginName').equals('maven-linkcheck-plugin')}">
<attainGoal name="maven-linkcheck-plugin:report-real"/>
</j:if>
</j:forEach>
</j:if>
</postGoal>
<goal
name="maven-linkcheck-plugin:report-real"
description="Generate link check results and then transform to HTML">
<mkdir dir="${maven.build.dir}/linkcheck"/>
<mkdir dir="${maven.build.dir}/linkcheck/docs"/>
<linkcheck:linkcheck
project="${pom}"
cache="${maven.linkcheck.cache}"
exclude="${pom.repository.url}"
basedir="${maven.docs.dest}"
output="${maven.build.dir}/linkcheck/linkcheck-results.xml"
outputEncoding="${maven.docs.outputencoding}"
/>
<doc:jsl
input="${maven.build.dir}/linkcheck/linkcheck-results.xml"
output="../linkcheck/docs/linkcheck.xml"
stylesheet="${plugin.resources}/linkcheck.jsl"
omitXmlDeclaration="true"
outputMode="xml"
prettyPrint="true"
/>
<j:set var="maven.xdoc.src" value="${maven.build.dir}/linkcheck/docs"/>
<attainGoal name="xdoc:performJSL"/>
</goal>
<goal name="maven-linkcheck-plugin:clearcache"
description="Removes the cache file">
<delete file="${maven.linkcheck.cache}"/>
</goal>
</project>