maven-plugins/dist/plugin.jelly
2004-07-03 18:08:21 +00:00

286 lines
9.2 KiB
XML

<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:maven="jelly:maven"
xmlns:artifact="artifact"
xmlns:deploy="deploy"
xmlns:util="jelly:util">
<!-- Poor mans version check - plugin dependencies still suck for multiple versions -->
<maven:get plugin="maven-artifact-plugin" property="plugin" var="artifactPlugin" />
<j:if test="${artifactPlugin.currentVersion.compareTo('1.3') lt 0}">
<ant:fail>
Must have artifact plugin v1.3 installed to use this version of the dist plugin.
Try: maven plugin:download -DgroupId=maven -DartifactId=maven-artifact-plugin -Dversion=1.3
</ant:fail>
</j:if>
<!-- Can remove deploy dependency above when this is gone -->
<maven:get plugin="maven-deploy-plugin" property="plugin" var="deployPlugin" />
<j:if test="${deployPlugin != null}">
<ant:fail>
Must remove the deploy plugin to use this version of the dist plugin.
Please delete ${deployPlugin.artifactId}-${deployPlugin.currentVersion}.jar from
${maven.plugin.dir} and ${maven.plugin.user.dir} (if it exists)
</ant:fail>
</j:if>
<j:new var="distTypeHandler" className="org.apache.maven.dist.DistributionArtifactTypeHandler" />
<!-- ================================================================== -->
<!-- D I S T R I B U T I O N S -->
<!-- ================================================================== -->
<goal
name="dist:prepare-bin-filesystem"
prereqs="xdoc:init, jar:jar, site:generate"
description="Builds the binary distribution file system.">
<!--
This is the directory where everything is copied to so that it can
be archived.
-->
<ant:delete dir="${maven.dist.bin.assembly.dir}"/>
<ant:mkdir dir="${maven.dist.bin.assembly.dir}"/>
<ant:echo>
+-------------------------------------------------------+
| C R E A T I N G B I N A R Y D I S T R I B U T I O N |
+-------------------------------------------------------+
</ant:echo>
<ant:copy todir="${maven.dist.bin.assembly.dir}">
<ant:fileset dir=".">
<ant:include name="README.txt"/>
<ant:include name="LICENSE*"/>
<ant:include name="NOTICE*"/>
</ant:fileset>
</ant:copy>
<!-- Copy Jars -->
<ant:copy todir="${maven.dist.bin.assembly.dir}">
<ant:fileset dir="${maven.build.dir}">
<ant:include name="${maven.final.name}.jar"/>
</ant:fileset>
</ant:copy>
<!-- Copy documentation -->
<j:set var="docsDest" value="${maven.docs.dest}"/>
<ant:copy todir="${maven.dist.bin.assembly.dir}/docs">
<ant:fileset dir="${docsDest}">
<ant:include name="**"/>
</ant:fileset>
</ant:copy>
</goal>
<goal
name="dist:prepare-src-filesystem"
description="Builds the source distribution file system.">
<!-- S O U R C E D I S T R I B U T I O N -->
<ant:delete dir="${maven.dist.src.assembly.dir}" />
<ant:mkdir dir="${maven.dist.src.assembly.dir}" />
<ant:echo>
+-------------------------------------------------------+
| C R E A T I N G S O U R C E D I S T R I B U T I O N |
+-------------------------------------------------------+
</ant:echo>
<ant:copy todir="${maven.dist.src.assembly.dir}">
<ant:fileset dir=".">
<ant:include name="README.txt"/>
<ant:include name="LICENSE*"/>
<ant:include name="NOTICE*"/>
<ant:include name="project.properties"/>
<ant:include name="maven.xml"/>
<ant:include name="project.xml"/>
</ant:fileset>
</ant:copy>
<ant:available property="maven.dist.build.xml.avail"
file="${basedir}/build.xml"/>
<j:if test="${maven.dist.build.xml.avail}">
<ant:copy todir="${maven.dist.src.assembly.dir}" file="${basedir}/build.xml"/>
</j:if>
<!-- Copy Source -->
<util:available file="${maven.src.dir}">
<ant:copy todir="${maven.dist.src.assembly.dir}/src">
<ant:fileset dir="${maven.src.dir}" />
</ant:copy>
</util:available>
</goal>
<goal name="dist"
prereqs="dist:build"
description="Build a complete distribution.">
</goal>
<goal
name="dist:build"
prereqs="dist:build-bin,dist:build-src"
description="Build a complete distribution.">
</goal>
<goal
name="dist:build-setup"
description="Set up directories for a distribution build">
<ant:delete dir="${maven.dist.dir}"/>
<ant:mkdir dir="${maven.dist.dir}"/>
</goal>
<goal
name="dist:build-bin"
prereqs="dist:build-setup,dist:prepare-bin-filesystem"
description="Build the binary distribution.">
<!-- Create a tar.gz file -->
<ant:tar longfile="gnu" tarfile="${maven.dist.dir}/${maven.final.name}.tar">
<ant:tarfileset dir="${maven.dist.bin.archive.dir}"/>
</ant:tar>
<ant:gzip
zipfile="${maven.dist.dir}/${maven.final.name}.tar.gz"
src="${maven.dist.dir}/${maven.final.name}.tar"
/>
<ant:delete file="${maven.dist.dir}/${maven.final.name}.tar"/>
<!-- Create a zip file -->
<ant:zip zipfile="${maven.dist.dir}/${maven.final.name}.zip">
<ant:zipfileset dir="${maven.dist.bin.archive.dir}"/>
</ant:zip>
</goal>
<goal
name="dist:build-src"
prereqs="dist:build-setup,dist:prepare-src-filesystem"
description="Build the source distribution.">
<!-- Create a tar.gz file -->
<ant:tar longfile="gnu" tarfile="${maven.dist.dir}/${maven.final.name}-src.tar">
<ant:tarfileset dir="${maven.dist.src.archive.dir}"/>
</ant:tar>
<ant:gzip
zipfile="${maven.dist.dir}/${maven.final.name}-src.tar.gz"
src="${maven.dist.dir}/${maven.final.name}-src.tar"
/>
<ant:delete file="${maven.dist.dir}/${maven.final.name}-src.tar"/>
<!-- Create a zip file -->
<ant:zip zipfile="${maven.dist.dir}/${maven.final.name}-src.zip">
<ant:zipfileset dir="${maven.dist.src.archive.dir}"/>
</ant:zip>
</goal>
<!-- ================================================================== -->
<!-- D E P L O Y D I S T R I B U T I O N -->
<!-- ================================================================== -->
<goal name="dist:deploy" description="Deploy a distribution"
prereqs="dist:deploy-bin,dist:deploy-src" />
<goal name="dist:deploy-bin" description="Deploy a binary distribution" prereqs="dist:build-bin">
<artifact:deploy
artifact="${maven.dist.dir}/${maven.final.name}.tar.gz"
type="distribution-targz"
project="${pom}"
typeHandler="${distTypeHandler}"
/>
<artifact:deploy
artifact="${maven.dist.dir}/${maven.final.name}.zip"
type="distribution-zip"
project="${pom}"
typeHandler="${distTypeHandler}"
/>
</goal>
<goal name="dist:deploy-src" description="Deploy a source distribution" prereqs="dist:build-src">
<artifact:deploy
artifact="${maven.dist.dir}/${maven.final.name}-src.tar.gz"
type="distribution-src-targz"
project="${pom}"
typeHandler="${distTypeHandler}"
/>
<artifact:deploy
artifact="${maven.dist.dir}/${maven.final.name}-src.zip"
type="distribution-src-zip"
project="${pom}"
typeHandler="${distTypeHandler}"
/>
</goal>
<!-- ================================================================== -->
<!-- D E P L O Y S N A P S H O T D I S T R I B U T I O N -->
<!-- ================================================================== -->
<goal name="dist:deploy-snapshot" description="Deploy a snapshot distribution"
prereqs="dist:deploy-bin-snapshot,dist:deploy-src-snapshot" />
<goal name="dist:deploy-bin-snapshot" description="Deploy a binary distribution" prereqs="dist:build-bin">
<artifact:deploy-snapshot
artifact="${maven.dist.dir}/${maven.final.name}.tar.gz"
type="distribution-targz"
project="${pom}"
typeHandler="${distTypeHandler}"
/>
<artifact:deploy-snapshot
artifact="${maven.dist.dir}/${maven.final.name}.zip"
type="distribution-zip"
project="${pom}"
typeHandler="${distTypeHandler}"
/>
</goal>
<goal name="dist:deploy-src-snapshot" description="Deploy a source distribution" prereqs="dist:build-src">
<artifact:deploy-snapshot
artifact="${maven.dist.dir}/${maven.final.name}-src.tar.gz"
type="distribution-src-targz"
project="${pom}"
typeHandler="${distTypeHandler}"
/>
<artifact:deploy-snapshot
artifact="${maven.dist.dir}/${maven.final.name}-src.zip"
type="distribution-src-zip"
project="${pom}"
typeHandler="${distTypeHandler}"
/>
</goal>
</project>