Add ability to auto-generate multi-project navigation based on the processed projects.

Sites can be aggregated under one filesystem, or independent, with absolute references in the navigation


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113586 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
dion
2003-07-04 05:06:40 +00:00
parent 1f0dfdc86a
commit 068819a9c0

View File

@@ -3,7 +3,15 @@
<project
xmlns:j="jelly:core"
xmlns:maven="jelly:maven"
xmlns:ant="jelly:ant">
xmlns:ant="jelly:ant"
xmlns:doc="doc"
xmlns:util="jelly:util"
xmlns:velocity="jelly:velocity">
<j:set var="maven.gen.docs"
value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.gen.docs')}"/>
<j:set var="maven.docs.dest"
value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.dest')}"/>
<goal name="multiproject"
description="Run the site goal of all subprojects"
@@ -13,17 +21,77 @@
<goal name="multiproject:site"
description="Run the site goal of all subprojects">
<attainGoal name="multiproject:create-nav"/>
<!-- generate site docs -->
<maven:reactor
basedir="${maven.multiproject.basedir}"
includes="${maven.multiproject.includes}"
excludes="${maven.multiproject.excludes}"
postProcessing="false"
postProcessing="true"
goals="clean,site"
ignoreFailures="${maven.multiproject.ignoreFailures}"
/>
<attainGoal name="site" />
<!-- copy or not? -->
<j:set var="navType" value="${maven.multiproject.navigation}"/>
<j:if test="${navType == 'aggregate'}">
<!-- copy each project over into ${maven.docs.dest} -->
<j:forEach var="reactorProject" items="${reactorProjects}">
<!-- note this is the same name as is generated in the navigation-aggregate.xml -->
<j:set var="directory" value="${maven.docs.dest}/multiproject/${reactorProject.name}"/>
<mkdir dir="${directory}"/>
<!--
${reactorProject.name} has docs directory
${reactorProject.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.dest')}
needing to be copied
-->
<j:set var="fromDir"
value="${reactorProject.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.dest')}"/>
<copy toDir="${directory}">
<fileset dir="${fromDir}"/>
</copy>
</j:forEach>
</j:if>
</goal>
<goal name="multiproject:create-nav">
<echo>gen docs is ${maven.gen.docs}</echo>
<mkdir dir="${maven.gen.docs}"/>
<!-- get all projects for template processing -->
<maven:reactor
basedir="${maven.multiproject.basedir}"
includes="${maven.multiproject.includes}"
excludes="${maven.multiproject.excludes}"
postProcessing="true"
ignoreFailures="true"
/>
<!-- generate navbar for project based on aggregate or independent -->
<j:set var="navType" value="${maven.multiproject.navigation}"/>
<j:if test="${navType != ''}">
<echo>Producing ${navType} navigation...</echo>
<velocity:merge
name="${maven.gen.docs}/navigation.xml"
basedir="${plugin.resources}/templates"
template="navigation-${navType}.xml"/>
</j:if>
<util:file var="userNavTemplate" name="${basedir}/multiproject/navigation.xml"/>
<j:if test="${userNavTemplate.exists()}">
<echo>Producing user supplied navigation...</echo>
<velocity:merge
name="${maven.gen.docs}/navigation.xml"
basedir="${basedir}/multiproject"
template="navigation.xml"/>
</j:if>
</goal>
<goal name="multiproject:goal" description="Run a given goal on all projects">
<!-- FIXME: This should be a tag somewhere else as it's common to do tag param checking -->
<j:if test="${empty(goal)}">