maven-plugins/site/plugin.jelly
2003-07-31 05:39:57 +00:00

170 lines
6.1 KiB
XML

<?xml version="1.0"?>
<project
xmlns:j="jelly:core"
xmlns:maven="jelly:maven">
<!-- ================================================================== -->
<!-- S I T E G E N E R A T I O N -->
<!-- ================================================================== -->
<goal name="site:generate" prereqs="site"/>
<goal name="site:init" prereqs="xdoc:init">
<j:set var="docsDest"
value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.dest')}"/>
</goal>
<goal
name="site"
description="Generate the web site">
<attainGoal name="site:run-reports"/>
<attainGoal name="xdoc"/>
</goal>
<goal name="site:run-reports" prereqs="xdoc:register-reports">
<j:set var="reports"
value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('reports')}"/>
<j:forEach var="report" items="${reports}">
<j:set var="reportName" value="${report.get('pluginName')}"/>
<j:if test="${!empty(reportName)}">
<echo>Generating the ${report.get('name')}...</echo>
<attainGoal name="${reportName}:report"/>
</j:if>
</j:forEach>
</goal>
<!-- ================================================================== -->
<!-- S I T E D E P L O Y -->
<!-- ================================================================== -->
<goal
name="site:deploy"
description="deploy the generated site docs">
<!--
|
| Generate the site documentation if it has not already been generated.
| We need some markers or timestamps for this so we don't repeat work
| if it's not necessary.
|
-->
<attainGoal name="site"/>
<!--
|
| Deploy the site using the maven.site.deploy.method property (right
| now possible variants are 'fs' and 'ssh')
|
-->
<attainGoal name="site:${maven.site.deploy.method}deploy"/>
</goal>
<!-- ================================================================== -->
<!-- S I T E S S H D E P L O Y -->
<!-- Deploys the site using SSH -->
<!-- ================================================================== -->
<goal name="site:sshdeploy"
prereqs="site:init"
description="Deploy the generated site docs using ssh">
<maven:user-check user="${maven.username}"/>
<echo>
siteAddress = ${pom.siteAddress}
siteDirectory = ${pom.siteDirectory}
siteUser = ${maven.username}
</echo>
<!-- This needs to taken from the project properties -->
<property name="maven.homepage" value="${pom.siteDirectory}"/>
<tar tarfile="${maven.build.dir}/${maven.final.name}-site.tar" basedir="${docsDest}"/>
<gzip zipfile="${maven.build.dir}/${maven.final.name}-site.tar.gz" src="${maven.build.dir}/${maven.final.name}-site.tar"/>
<delete file="${maven.build.dir}/${maven.final.name}-site.tar"/>
<!-- Make sure the destination directory exists before trying to copy -->
<exec dir="." executable="${maven.ssh.executable}">
<arg line="${pom.siteAddress} -l ${maven.username} 'mkdir -p ${maven.homepage}'"/>
</exec>
<exec dir="${maven.build.dir}" executable="${maven.scp.executable}">
<arg value="${maven.final.name}-site.tar.gz"/>
<arg value="${maven.username}@${pom.siteAddress}:${maven.homepage}"/>
</exec>
<exec dir="." executable="${maven.ssh.executable}">
<arg line="${pom.siteAddress} -l ${maven.username} 'cd ${maven.homepage};${maven.site.gunzip.executable} ${maven.final.name}-site.tar.gz;${maven.site.tar.executable} xUvf ${maven.final.name}-site.tar;chmod -R g+u *;rm ${maven.final.name}-site.tar'"/>
</exec>
<delete file="${maven.build.dir}/${maven.final.name}-site.tar.gz"/>
</goal>
<!-- ================================================================== -->
<!-- S I T E F S D E P L O Y -->
<!-- Deploys the site by copying to another file system -->
<!-- ================================================================== -->
<goal name="site:fsdeploy"
prereqs="site:init"
description="Deploy the generated site by copying to the site directory">
<echo>
siteAddress = ${pom.siteAddress}
siteDirectory = ${pom.siteDirectory}
</echo>
<!-- copy the site to the directory specified in the project.xml file -->
<copy todir="${pom.siteDirectory}">
<fileset dir="${docsDest}">
<include name="**"/>
</fileset>
</copy>
</goal>
<goal name="site:war" description="Create a WAR File from the generated site"
prereqs="site:init, site">
<mkdir dir="${docsDest}/WEB-INF" />
<war destfile="${maven.build.dir}/${maven.final.name}-site.war"
webxml="${plugin.resources}/web.xml">
<fileset dir="${docsDest}" />
</war>
</goal>
<goal name="site:ear" prereqs="site:war"
description="Create an EAR File from the generated site">
<j:set var="docType1" value="&lt;" />
<j:set var="docType2">!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN' 'http://java.sun.com/j2ee/dtds/application_1_2.dtd'</j:set>
<j:set var="docType3" value="&gt;" />
<mkdir dir="${maven.build.dir}/${plugin.artifactId}" />
<j:set var="warName" value="${maven.final.name}-site.war" />
<copy file="${plugin.resources}/application.xml"
tofile="${maven.build.dir}/${plugin.artifactId}/application.xml"/>
<replace file="${maven.build.dir}/${plugin.artifactId}/application.xml">
<replacefilter token="@name@" value="${pom.artifactId}"/>
<replacefilter token="@shortDescription@"
value="${pom.shortDescription}"/>
<replacefilter token="@warName@" value="${warName}" />
<replacefilter token="@contextRoot@" value="${maven.final.name}" />
</replace>
<ear destfile="${maven.build.dir}/${maven.final.name}-site.ear"
appxml="${maven.build.dir}/${plugin.artifactId}/application.xml">
<fileset dir="${maven.build.dir}" includes="${maven.final.name}-site.war" />
</ear>
</goal>
</project>