maven-plugins/rar/plugin.jelly
2004-07-06 12:37:18 +00:00

196 lines
7.7 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:artifact="artifact"
xmlns:license="license"
xmlns:maven="jelly:maven"
xmlns:util="jelly:util"
>
<!--==================================================================-->
<!-- Default goal : Builds a rar file -->
<!--==================================================================-->
<goal name="rar" prereqs="rar:rar" description="Build a rar file"/>
<!--==================================================================-->
<!-- Initializations -->
<!--==================================================================-->
<goal name="rar:init"
description="Initialise filesystem and other resources for a rar">
<ant:mkdir dir="${maven.build.dir}"/>
</goal>
<!--==================================================================-->
<!-- Builds an rar file -->
<!--==================================================================-->
<goal name="rar:rar" prereqs="rar:init" description="Build a rar file">
<ant:echo>Building rar ${maven.final.name} with ra.xml "${maven.rar.raxml}"</ant:echo>
<ant:available property="maven.rar.manifest.available"
file="${maven.rar.manifest}"/>
<ant:jar destfile="${maven.build.dir}/${maven.final.name}.rar">
<!-- include files from maven.rar.src if available -->
<util:available file="${maven.rar.src}">
<fileset dir="${maven.rar.src}" casesensitive="false"/>
</util:available>
<!-- include built jar if available -->
<ant:echo>trying to include ${maven.build.dir}/${maven.final.name}.jar</ant:echo>
<util:available file="${maven.build.dir}/${maven.final.name}.jar">
<ant:fileset dir="${maven.build.dir}">
<ant:include name="${maven.final.name}.jar"/>
</ant:fileset>
</util:available>
<!-- include marked dependencies -->
<j:forEach var="lib" items="${pom.artifacts}">
<j:set var="dep" value="${lib.dependency}"/>
<j:if test="${dep.getProperty('rar.bundle')=='true'}">
<!--
We know that this dep "wants" to be bundled.
-->
<ant:echo>Bundling: ${dep.type} - ${dep.id}</ant:echo>
<ant:fileset dir="${lib.file.parent}">
<ant:include name="${lib.file.name}"/>
</ant:fileset>
</j:if>
</j:forEach>
<!-- include license -->
<j:set var="licenseFileName"><license:fileName/></j:set>
<util:file name="${licenseFileName}" var="licenseFile"/>
<ant:metainf dir="${licenseFile.canonicalFile.parent}">
<ant:include name="${licenseFile.canonicalFile.name}"/>
</ant:metainf>
<j:if test="${maven.rar.manifest.available}">
<ant:setProperty name="manifest" value="${maven.rar.manifest}"/>
</j:if>
<!-- standard manifest entries -->
<ant:manifest>
<ant:attribute name="Built-By" value="${user.name}"/>
<ant:section name="${pom.package}">
<ant:attribute name="Specification-Title" value="${pom.artifactId}"/>
<ant:attribute name="Specification-Version"
value="${pom.currentVersion}"/>
<ant:attribute name="Specification-Vendor"
value="${pom.organization.name}"/>
<ant:attribute name="Implementation-Title"
value="${pom.package}"/>
<ant:attribute name="Implementation-Version"
value="${pom.currentVersion}"/>
<ant:attribute name="Implementation-Vendor"
value="${pom.organization.name}"/>
</ant:section>
</ant:manifest>
<j:if test="${!pom.build.resources.isEmpty()}">
<mkdir dir="${maven.rar.resources}"/>
<maven:copy-resources resources="${pom.build.resources}" todir="${maven.rar.resources}"/>
<fileset dir="${maven.rar.resources}"/>
</j:if>
</ant:jar>
</goal>
<!--==================================================================-->
<!-- Install the rar in the local repository -->
<!--==================================================================-->
<goal name="rar:install"
prereqs="rar:rar"
description="Install the rar in the local repository">
<artifact:install
artifact="${maven.build.dir}/${maven.final.name}.rar"
type="rar"
project="${pom}"/>
</goal>
<!--==================================================================-->
<!-- Install the snapshot version of the rar in the local repository -->
<!--==================================================================-->
<goal name="rar:install-snapshot"
prereqs="rar:rar"
description="Install the snapshot version of the rar in the local repository">
<artifact:install-snapshot
artifact="${maven.build.dir}/${maven.final.name}.rar"
type="rar"
project="${pom}"/>
</goal>
<!--==================================================================-->
<!-- Deploys the rar to the remote repository -->
<!--==================================================================-->
<goal name="rar:deploy"
prereqs="rar:rar"
description="Deploys the rar to the remote repository">
<artifact:deploy
artifact="${maven.build.dir}/${maven.final.name}.rar"
type="rar"
project="${pom}"/>
</goal>
<!--==================================================================-->
<!-- Deploys the snapshot version of the rar to the remote repository -->
<!--==================================================================-->
<goal name="rar:deploy-snapshot"
prereqs="rar:rar"
description="Deploys the snapshot version of the rar to remote repository">
<artifact:deploy-snapshot
artifact="${maven.build.dir}/${maven.final.name}.rar"
type="rar"
project="${pom}"/>
</goal>
<!--==================================================================-->
<!-- Special no-op goal which can be used by other plugin which need -->
<!-- to get access to any of this plugin's property. This is -->
<!-- temporary, until we get explicit plugin dependencies. -->
<!--==================================================================-->
<goal name="rar:load" description="no-op goal">
<echo>DEPRECATED: rar:load is deprecated. Please use maven:get to obtain variables</echo>
</goal>
</project>