git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114687 13f79535-47bb-0310-9956-ffa450edef68
327 lines
12 KiB
XML
327 lines
12 KiB
XML
<?xml version="1.0"?>
|
|
|
|
<project
|
|
xmlns:ant="jelly:ant"
|
|
xmlns:define="jelly:define"
|
|
xmlns:doc="doc"
|
|
xmlns:j="jelly:core"
|
|
xmlns:util="jelly:util"
|
|
xmlns:artifact="artifact"
|
|
xmlns:javadoc="javadoc"
|
|
>
|
|
|
|
<goal name="maven-javadoc-plugin:register">
|
|
|
|
<javadoc:check-needed/>
|
|
|
|
<j:if test="${needed}">
|
|
<doc:registerReport
|
|
name="JavaDocs"
|
|
pluginName="maven-javadoc-plugin"
|
|
link="apidocs/index"
|
|
description="JavaDoc API documentation."/>
|
|
<doc:registerReport
|
|
name="JavaDoc Report"
|
|
pluginName=""
|
|
link="javadoc"
|
|
description="Report on the generation of JavaDoc."/>
|
|
</j:if>
|
|
</goal>
|
|
|
|
<goal name="maven-javadoc-plugin:deregister">
|
|
<doc:deregisterReport name="JavaDocs"/>
|
|
<doc:deregisterReport name="JavaDoc Report"/>
|
|
</goal>
|
|
|
|
<!-- ================================================================== -->
|
|
<!-- Test if we need to call javadoc -->
|
|
<!-- ================================================================== -->
|
|
|
|
<define:taglib uri="javadoc">
|
|
<define:tag name="check-needed">
|
|
|
|
<j:choose>
|
|
<j:when test="${needed != null}">
|
|
<!-- We have already decided if javadoc is needed -->
|
|
</j:when>
|
|
<j:when test="${sourcesPresent != 'true'}">
|
|
<j:set var="needed" value="false" />
|
|
</j:when>
|
|
<j:otherwise>
|
|
<ant:fileset id="sourceSet" dir="${pom.build.sourceDirectory}">
|
|
<ant:include name="**/*.java"/>
|
|
<!-- FIXME: This is a bad cut and paste -->
|
|
<!-- handle source modifications -->
|
|
<j:forEach var="sm" items="${pom.build.sourceModifications}">
|
|
<ant:available property="classPresent" classname="${sm.className}"/>
|
|
<j:if test="${classPresent != 'true'}">
|
|
<j:forEach var="exclude" items="${sm.excludes}">
|
|
<ant:exclude name="${exclude}"/>
|
|
</j:forEach>
|
|
<j:forEach var="include" items="${sm.includes}">
|
|
<ant:include name="${include}"/>
|
|
</j:forEach>
|
|
</j:if>
|
|
</j:forEach>
|
|
</ant:fileset>
|
|
|
|
<ant:fileScanner var="sources">
|
|
<ant:fileset refid="sourceSet" />
|
|
</ant:fileScanner>
|
|
|
|
<j:set var="needed" scope="parent"
|
|
value="${sources.iterator().hasNext()}" />
|
|
</j:otherwise>
|
|
</j:choose>
|
|
|
|
</define:tag>
|
|
</define:taglib>
|
|
|
|
<!-- ================================================================== -->
|
|
<!-- J A V A D O C S -->
|
|
<!-- ================================================================== -->
|
|
|
|
<!-- Some aliases for ease of use and backward compat. -->
|
|
<goal name="javadoc:generate" prereqs="maven-javadoc-plugin:report"/>
|
|
<goal name="javadoc" prereqs="maven-javadoc-plugin:report"/>
|
|
|
|
<goal name="maven-javadoc-plugin:report"
|
|
prereqs="xdoc:init"
|
|
description="Generate API documentation">
|
|
|
|
<javadoc:check-needed/>
|
|
|
|
<j:if test="${needed}">
|
|
|
|
<ant:mkdir dir="${maven.javadoc.destdir}"/>
|
|
|
|
<!-- Get the year to display in the Javadocs -->
|
|
<ant:tstamp>
|
|
<ant:format property="currentYear" pattern="yyyy"/>
|
|
</ant:tstamp>
|
|
<ant:tstamp>
|
|
<j:choose>
|
|
<j:when test="${pom.inceptionYear.equals(currentYear)}">
|
|
<ant:format property="year" pattern="yyyy"/>
|
|
</j:when>
|
|
<j:otherwise>
|
|
<ant:format property="year" pattern="${pom.inceptionYear}-yyyy"/>
|
|
</j:otherwise>
|
|
</j:choose>
|
|
</ant:tstamp>
|
|
|
|
<ant:property name="copyright"
|
|
value="Copyright &copy; ${year} ${pom.organization.name}. All Rights Reserved." />
|
|
|
|
<!-- calculate online/offline mode -->
|
|
<j:set var="online" value="${maven.javadoc.mode.online}"/>
|
|
<j:if test="${empty(online)}">
|
|
<j:set var="online" value="${maven.mode.online}"/>
|
|
</j:if>
|
|
|
|
<j:choose>
|
|
<j:when test="${online}">
|
|
<util:tokenize var="links" delim="," trim="true">${maven.javadoc.links}</util:tokenize>
|
|
<j:forEach var="link" items="${links}">
|
|
<ant:echo>Linking with API information from ${link.trim()} ...</ant:echo>
|
|
</j:forEach>
|
|
</j:when>
|
|
<j:otherwise>
|
|
<util:tokenize var="links" delim="," trim="true">${maven.javadoc.offlineLinks}</util:tokenize>
|
|
<j:forEach var="link" items="${links}">
|
|
<ant:echo>Linking offline API information from ${link.trim()} ...</ant:echo>
|
|
</j:forEach>
|
|
</j:otherwise>
|
|
</j:choose>
|
|
|
|
<j:set var="maxMemory" value="${maven.javadoc.maxmemory}" />
|
|
|
|
<ant:mkdir dir="${maven.build.dir}/javadoc/" />
|
|
<ant:record name="${maven.build.dir}/javadoc/report.txt" action="start" />
|
|
|
|
<ant:javadoc
|
|
packagenames="${pom.package}.*"
|
|
destdir="${maven.javadoc.destdir}"
|
|
author="${maven.javadoc.author}"
|
|
public="${maven.javadoc.public}"
|
|
package="${maven.javadoc.package}"
|
|
private="${maven.javadoc.private}"
|
|
version="${maven.javadoc.version}"
|
|
use="${maven.javadoc.use}"
|
|
windowtitle="${maven.javadoc.windowtitle}"
|
|
doctitle="${maven.javadoc.windowtitle}"
|
|
bottom="${copyright}"
|
|
stylesheetfile="${maven.javadoc.stylesheet}"
|
|
additionalparam="${maven.javadoc.additionalparam}"
|
|
useexternalfile="${maven.javadoc.useexternalfile}">
|
|
|
|
<!-- sourceSet is set by the javadoc:check-needed function -->
|
|
<ant:fileset refid="sourceSet" />
|
|
|
|
<j:if test="${context.getVariable('maven.javadoc.source') != null}">
|
|
<ant:setProperty name="source" value="${maven.javadoc.source}" />
|
|
</j:if>
|
|
|
|
<!-- Process/Parse links -->
|
|
<!-- This code allows to specify a packagelistLoc even when in online mode -->
|
|
<j:forEach var="link" items="${links}">
|
|
<j:set var="pos" value="${link.indexOf('#')}" />
|
|
|
|
<!-- set href and packagelistLoc -->
|
|
<j:choose>
|
|
<!-- I am bad with jelly, the test is: "pos == -1" -->
|
|
<j:when test="${1+pos == 0}">
|
|
<j:set var="href" value="${link.trim()}" />
|
|
<j:set var="packagelistLoc" value="${href}"/>
|
|
</j:when>
|
|
<j:otherwise>
|
|
<j:set var="href" value="${link.substring(0,pos).trim()}"/>
|
|
<j:set var="packagelistLoc" value="${link.substring(pos).substring(1).trim()}"/>
|
|
</j:otherwise>
|
|
</j:choose>
|
|
|
|
<!-- generate the link -->
|
|
<j:choose>
|
|
<j:when test="${online}" >
|
|
<ant:link href="${href}" offline="false" packagelistLoc="${packagelistLoc}" />
|
|
</j:when>
|
|
<j:otherwise>
|
|
<ant:link href="${href}" offline="true" packagelistLoc="${packagelistLoc}" />
|
|
</j:otherwise>
|
|
</j:choose>
|
|
</j:forEach>
|
|
|
|
<ant:classpath>
|
|
<ant:path refid="maven.dependency.classpath"/>
|
|
<ant:path location="${maven.build.dest}"/>
|
|
</ant:classpath>
|
|
|
|
<j:if test="${context.getVariable('maven.javadoc.locale') != null}">
|
|
<ant:setProperty name="locale" value="${maven.javadoc.locale}" />
|
|
</j:if>
|
|
|
|
<j:if test="${context.getVariable('maven.javadoc.overview') != null}">
|
|
<ant:setProperty name="overview" value="${maven.javadoc.overview}" />
|
|
</j:if>
|
|
|
|
<j:if test="${maxMemory != null}">
|
|
<ant:setProperty name="maxmemory" value="${maven.javadoc.maxmemory}" />
|
|
</j:if>
|
|
|
|
<j:forEach var="packageGroup" items="${pom.packageGroups}">
|
|
<ant:group title="${packageGroup.title}" packages="${packageGroup.packages}"/>
|
|
</j:forEach>
|
|
|
|
<!-- allow custom doclets -->
|
|
<j:if test="${context.getVariable('maven.javadoc.doclet') != null}">
|
|
<ant:setProperty name="doclet" value="${maven.javadoc.doclet}" />
|
|
</j:if>
|
|
<j:if test="${context.getVariable('maven.javadoc.docletpath') != null}">
|
|
<ant:setProperty name="docletpath" value="${maven.javadoc.docletpath}" />
|
|
</j:if>
|
|
|
|
<!-- allow custom tags -->
|
|
<util:tokenize var="listOfTags" delim=" ">${maven.javadoc.customtags}</util:tokenize>
|
|
<j:forEach var="someTag" items="${listOfTags}">
|
|
<j:set var="nameVar" value="${someTag}.name"/>
|
|
<j:set var="name" value="${context.findVariable(nameVar)}"/>
|
|
<j:set var="descriptionVar" value="${someTag}.description"/>
|
|
<j:set var="description" value="${context.findVariable(descriptionVar)}"/>
|
|
<j:set var="enabledVar" value="${someTag}.enabled"/>
|
|
<j:set var="enabled" value="${context.findVariable(enabledVar)}"/>
|
|
<j:set var="scopeVar" value="${someTag}.scope"/>
|
|
<j:set var="scope" value="${context.findVariable(scopeVar)}"/>
|
|
<ant:tag name="${name}" description="${description}"
|
|
enabled="${enabled}" scope="${scope}"/>
|
|
</j:forEach>
|
|
|
|
<!-- allow taglets -->
|
|
<util:tokenize var="listOfTaglets" delim="," trim="true">${maven.javadoc.taglets}</util:tokenize>
|
|
<j:set var="tagletPath" value="${context.getVariable('maven.javadoc.tagletpath')}" />
|
|
<j:forEach var="someTaglet" items="${listOfTaglets}">
|
|
<ant:taglet name="${someTaglet}" path="${tagletPath}" />
|
|
</j:forEach>
|
|
|
|
</ant:javadoc>
|
|
<ant:record name="${maven.build.dir}/javadoc/report.txt" action="stop" />
|
|
|
|
<j:set var="genDocs" value="${maven.gen.docs}" />
|
|
<doc:text-xdoc
|
|
title="Javadoc Report"
|
|
section="Javadoc Report"
|
|
inputFile="${maven.build.dir}/javadoc/report.txt"
|
|
output="${genDocs}/javadoc.xml"/>
|
|
</j:if>
|
|
|
|
</goal>
|
|
|
|
<!--==================================================================-->
|
|
<!-- Create a jar file containing the javadoc -->
|
|
<!--==================================================================-->
|
|
<goal name="javadoc:jar" prereqs="javadoc">
|
|
<j:set var="maven.javadoc.final.name"
|
|
value="${maven.war.build.dir}/${maven.final.name}_javadoc.jar" />
|
|
<ant:jar
|
|
destfile="${maven.javadoc.final.name}"
|
|
basedir="${maven.javadoc.destdir}"
|
|
update="true">
|
|
</ant:jar>
|
|
</goal>
|
|
|
|
<!--==================================================================-->
|
|
<!-- Install the jar in the local repository -->
|
|
<!--==================================================================-->
|
|
<goal name="javadoc:install"
|
|
prereqs="javadoc:jar"
|
|
description="Install the jar containing javadoc in the local repository">
|
|
|
|
<artifact:install
|
|
artifact="${maven.javadoc.final.name}"
|
|
type="javadoc"
|
|
project="${pom}"/>
|
|
|
|
</goal>
|
|
|
|
<!--==================================================================-->
|
|
<!-- Install the snapshot version of the jar in the local repository -->
|
|
<!--==================================================================-->
|
|
<goal name="javadoc:install-snapshot"
|
|
prereqs="javadoc:jar"
|
|
description="Install the snapshot version of the jar containing javadoc in the local repository">
|
|
|
|
<artifact:install-snapshot
|
|
artifact="${maven.javadoc.final.name}"
|
|
type="javadoc"
|
|
project="${pom}"/>
|
|
|
|
</goal>
|
|
|
|
<!--==================================================================-->
|
|
<!-- Deploys the javadoc to the remote repository -->
|
|
<!--==================================================================-->
|
|
<goal name="javadoc:deploy"
|
|
prereqs="javadoc:jar"
|
|
description="Deploys the jar containing javadoc to the remote repository">
|
|
|
|
<artifact:deploy
|
|
artifact="${maven.javadoc.final.name}"
|
|
type="javadoc"
|
|
project="${pom}"/>
|
|
|
|
</goal>
|
|
|
|
<!--==================================================================-->
|
|
<!-- Deploys the snapshot of the javadoc to the remote repository -->
|
|
<!--==================================================================-->
|
|
<goal name="javadoc:deploy-snapshot"
|
|
prereqs="javadoc:jar"
|
|
description="Deploys the snapshot version of jar containing javadoc to remote repository">
|
|
|
|
<artifact:deploy-snapshot
|
|
artifact="${maven.javadoc.final.name}"
|
|
type="javadoc"
|
|
project="${pom}"/>
|
|
|
|
</goal>
|
|
</project>
|