maven-plugins/linkcheck/plugin.jelly
2003-02-02 13:44:55 +00:00

93 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')}"/>
<j:if test="${context.getVariable('maven.linkcheck.enable') != null}">
<j:set var="maven.linkcheck.enable" value="true"/>
</j:if>
<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"
link="linkcheck"
description="Report on the validity of all links in the documentation."/>
</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">
<echo>This run of linkcheck does nothing except create a template linkcheck file</echo>
<copy file="${plugin.resources}/linkcheck-temp.xml" toFile="${maven.gen.docs}/linkcheck.xml"/>
</goal>
<postGoal name="xdoc:jelly-transform">
<attainGoal name="maven-linkcheck-plugin:report-real"/>
</postGoal>
<goal
name="maven-linkcheck-plugin:report-real"
description="Generate a report from the link check results">
<echo>BaseDir: ${basedir}</echo>
<mkdir dir="${maven.build.dir}/linkcheck"/>
<mkdir dir="${maven.build.dir}/linkcheck/docs"/>
<j:choose>
<j:when test="${maven.linkcheck.enable}">
<echo>Generating the LinkCheck report</echo>
<linkcheck:linkcheck
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"/>
<echo>maven.xdoc.src: ${maven.xdoc.src}</echo>
<attainGoal name="xdoc:performJSL"/>
</j:when>
<j:otherwise>
<echo>LinkCheck not enabled as maven.linkcheck.enable is not defined.</echo>
</j:otherwise>
</j:choose>
</goal>
<goal name="maven-linkcheck-plugin:clearcache"
description="Removes the cache file">
<delete file="${maven.linkcheck.cache}"/>
</goal>
</project>