git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@375769 13f79535-47bb-0310-9956-ffa450edef68
305 lines
11 KiB
XML
305 lines
11 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:define="jelly:define"
|
|
xmlns:ant="jelly:ant"
|
|
xmlns:util="jelly:util"
|
|
xmlns:maven="jelly:maven"
|
|
xmlns:velocity="jelly:velocity"
|
|
xmlns:artifact="artifact"
|
|
xmlns:deploy="deploy"
|
|
>
|
|
|
|
<j:set var="version" value="${maven.application.version}" />
|
|
<j:if test="${version.compareTo('1.1') lt 0}">
|
|
<ant:fail>
|
|
Maven Artifact Plugin v${plugin.currentVersion} requires Maven 1.1 or above.
|
|
To correct this installation, remove:
|
|
${maven.home}/plugins/maven-artifact-plugin-${plugin.currentVersion}.jar
|
|
and run:
|
|
maven plugin:download -DgroupId=maven -DartifactId=maven-artifact-plugin -Dversion=1.5.2
|
|
</ant:fail>
|
|
</j:if>
|
|
|
|
|
|
<define:taglib uri="artifact">
|
|
|
|
<!-- For times the same bean is used. -->
|
|
<define:jellybean
|
|
name="artifact-install"
|
|
method="install"
|
|
className="org.apache.maven.artifact.deployer.DeployBean"/>
|
|
|
|
<define:jellybean
|
|
name="artifact-install-snapshot"
|
|
method="installSnapshot"
|
|
className="org.apache.maven.artifact.deployer.DeployBean"/>
|
|
|
|
<define:jellybean
|
|
name="artifact-deploy"
|
|
method="deploy"
|
|
className="org.apache.maven.artifact.deployer.DeployBean"/>
|
|
|
|
<define:jellybean
|
|
name="artifact-deploy-snapshot"
|
|
method="deploySnapshot"
|
|
className="org.apache.maven.artifact.deployer.DeployBean"/>
|
|
|
|
<define:tag name="install">
|
|
<ant:echo>Installing...</ant:echo>
|
|
<artifact:artifact-install
|
|
project="${project}"
|
|
type="${type}"
|
|
artifact="${artifact}"
|
|
artifactIdOverride="${artifactIdOverride}"
|
|
typeHandler="${typeHandler}"
|
|
/>
|
|
</define:tag>
|
|
|
|
<define:tag name="install-snapshot">
|
|
<ant:echo>Installing as a snapshot...</ant:echo>
|
|
<ant:echo>
|
|
**********************************************************
|
|
DEPRECATED: install/deploy-snapshot goals are deprecated.
|
|
Please use install/deploy with a version set to SNAPSHOT
|
|
**********************************************************
|
|
</ant:echo>
|
|
<artifact:artifact-install-snapshot
|
|
project="${project}"
|
|
type="${type}"
|
|
artifact="${artifact}"
|
|
typeHandler="${typeHandler}"
|
|
/>
|
|
</define:tag>
|
|
|
|
<define:tag name="deploy">
|
|
<ant:echo>Deploying...</ant:echo>
|
|
<artifact:check-legacy />
|
|
|
|
<artifact:artifact-deploy
|
|
project="${project}"
|
|
type="${type}"
|
|
artifact="${artifact}"
|
|
artifactIdOverride="${artifactIdOverride}"
|
|
typeHandler="${typeHandler}"
|
|
/>
|
|
</define:tag>
|
|
|
|
<define:tag name="deploy-snapshot">
|
|
<ant:echo>Deploying as snapshot...</ant:echo>
|
|
<ant:echo>
|
|
**********************************************************
|
|
DEPRECATED: install/deploy-snapshot goals are deprecated.
|
|
Please use install/deploy with a version set to SNAPSHOT
|
|
**********************************************************
|
|
</ant:echo>
|
|
<artifact:check-legacy />
|
|
|
|
<artifact:artifact-deploy-snapshot
|
|
project="${project}"
|
|
type="${type}"
|
|
artifact="${artifact}"
|
|
typeHandler="${typeHandler}"
|
|
/>
|
|
</define:tag>
|
|
|
|
<define:tag name="check-legacy">
|
|
<j:choose>
|
|
<j:when test="${context.getVariable('maven.artifact.legacy') == 'true'}">
|
|
<ant:fail>legacy deploy mode no longer supported - maven.artifact.legacy is set to true</ant:fail>
|
|
</j:when>
|
|
<j:when test="${context.getVariable('maven.repo.list') == null}">
|
|
<ant:fail>legacy deploy mode no longer supported - please set maven.repo.list</ant:fail>
|
|
</j:when>
|
|
</j:choose>
|
|
</define:tag>
|
|
|
|
<!--
|
|
|
|
|
| @filename
|
|
| @templateBasedir
|
|
| @template
|
|
|
|
|
|
|
|
|
|
|
-->
|
|
<define:tag name="manifest-file">
|
|
|
|
<j:if test="${templateBasedir == null}">
|
|
<j:set var="templateBasedir" value="${maven.artifact.manifest.basedir}"/>
|
|
</j:if>
|
|
|
|
<j:if test="${template == null}">
|
|
<j:set var="template" value="${maven.artifact.manifest.template}"/>
|
|
</j:if>
|
|
|
|
<j:set var="mainclass" value="${maven.artifact.manifest.mainclass}"/>
|
|
|
|
<j:set var="addExtensions" value="${maven.artifact.manifest.extensions.add}"/>
|
|
|
|
<ant:echo>Creating MANIFEST file:${filename}</ant:echo>
|
|
<ant:echo>Mainclass: ${mainclass}</ant:echo>
|
|
<ant:echo>addExtensions ${addExtensions}</ant:echo>
|
|
|
|
<velocity:merge
|
|
name="${filename}"
|
|
basedir="${templateBasedir}"
|
|
template="${template}"/>
|
|
</define:tag>
|
|
|
|
<define:tag name="rewritePOM">
|
|
<maven:param-check value="${path}" fail="true" message="'path' must be specified"/>
|
|
<ant:echo>Rewriting POM...</ant:echo>
|
|
<j:invokeStatic className="org.apache.maven.artifact.PomRewriter" method="getRewrittenPom" var="pomFile">
|
|
<j:arg value="${pom}"/>
|
|
</j:invokeStatic>
|
|
<ant:copy file="${pomFile.path}" tofile="${path}"/>
|
|
</define:tag>
|
|
|
|
</define:taglib>
|
|
|
|
<goal name="artifact:load">
|
|
<ant:echo>
|
|
DEPRECATED: you do not need to use artifact:load for plugin dependencies.
|
|
</ant:echo>
|
|
</goal>
|
|
|
|
<goal name="artifact:create-upload-bundle">
|
|
<!-- Create the artifact in question. -->
|
|
<attainGoal name="jar:jar"/>
|
|
|
|
<!-- Delete/create the bundle holding tank -->
|
|
<ant:delete dir="${maven.build.dir}/bundle"/>
|
|
<ant:mkdir dir="${maven.build.dir}/bundle"/>
|
|
|
|
<!-- Copy in the artifact -->
|
|
<ant:copy file="${maven.build.dir}/${maven.jar.final.name}" todir="${maven.build.dir}/bundle"/>
|
|
|
|
<!-- Copy in the rewritten POM -->
|
|
<artifact:rewritePOM path="${maven.build.dir}/bundle/project.xml"/>
|
|
|
|
<!-- Copy in the license, if there is no license this will fail. -->
|
|
<maven:get plugin="maven-license-plugin" property="maven.license.licenseFile" var="license"/>
|
|
<ant:echo>Copying license: ${license}</ant:echo>
|
|
<ant:copy file="${license}" todir="${maven.build.dir}/bundle"/>
|
|
|
|
<!-- Add sources -->
|
|
<ant:jar jarfile="${maven.build.dir}/bundle/${maven.final.name}-sources.jar">
|
|
<util:tokenize var="sources_dirs" delim="${path.separator}">${context.getAntProject().getReferences().get('maven.compile.src.set')}</util:tokenize>
|
|
<j:forEach var="dir" items="${sources_dirs}">
|
|
<ant:fileset dir="${dir}" />
|
|
</j:forEach>
|
|
<ant:manifest>
|
|
<ant:attribute name="Built-By" value="${user.name}"/>
|
|
<ant:attribute name="Created-By" value="Apache Maven"/>
|
|
<ant:attribute name="Package" value="${pom.package}"/>
|
|
<ant:attribute name="Build-Jdk" value="${java.version}"/>
|
|
<ant:attribute name="Extension-Name" value="${pom.artifactId}"/>
|
|
<ant:attribute name="Specification-Vendor" value="${pom.organization.name}"/>
|
|
<ant:attribute name="Implementation-Title" value="${pom.package}"/>
|
|
<ant:attribute name="Implementation-Vendor" value="${pom.organization.name}"/>
|
|
<ant:attribute name="Implementation-Version" value="${pom.currentVersion}"/>
|
|
</ant:manifest>
|
|
</ant:jar>
|
|
|
|
<ant:jar
|
|
jarfile="${maven.build.dir}/${maven.final.name}-bundle.jar"
|
|
basedir="${maven.build.dir}/bundle"/>
|
|
|
|
</goal>
|
|
|
|
|
|
<!-- ================================================================== -->
|
|
<!-- D E P L O Y A R T I F A C T T A G -->
|
|
<!-- ================================================================== -->
|
|
<!-- The deploy-artifact tag is a dynamic tag that allows the -->
|
|
<!-- consistent deployment of artifacts generated by Maven. -->
|
|
<!-- -->
|
|
<!-- The following parameters can be used with the deploy-artifact -->
|
|
<!-- tag by setting the appropriate attribute when invoking the tag: -->
|
|
<!-- -->
|
|
<!-- @param artifact -->
|
|
<!-- @param type -->
|
|
<!-- @param assureDirectoryCommand -->
|
|
<!-- ================================================================== -->
|
|
|
|
<define:taglib uri="deploy">
|
|
<define:tag name="artifact">
|
|
<ant:fail>use of deploy:artifact tag is no longer supported. Please use the artifact:* tags instead.</ant:fail>
|
|
</define:tag>
|
|
|
|
<!-- ================================================================== -->
|
|
<!-- C O P Y D E P S -->
|
|
<!-- ================================================================== -->
|
|
|
|
<define:tag name="copy-deps">
|
|
<!--
|
|
|
|
|
| If a POM descriptor has been specified then use it.
|
|
|
|
|
-->
|
|
<j:if test="${projectDescriptor != null}">
|
|
<maven:pom var="pom" projectDescriptor="${projectDescriptor}"/>
|
|
</j:if>
|
|
|
|
<j:set var="mavenRepoLocal" value='${context.getVariable("maven.repo.local")}'/>
|
|
<!-- grab list of excludedItems up front -->
|
|
<j:if test="${excludes != ''}">
|
|
<!-- The excludes are a list of dep ids -->
|
|
<util:tokenize var="excludeItems" delim=",">${excludes}</util:tokenize>
|
|
</j:if>
|
|
|
|
<j:useList var="includedLibs" />
|
|
<!--
|
|
! for each artifact, see if it is excluded. If not, add a fileset
|
|
! to the copy
|
|
!-->
|
|
<j:forEach var="lib" items="${pom.artifacts}">
|
|
<j:set var="excluded" value="false"/>
|
|
<j:if test="${excludes != ''}">
|
|
<!-- The excludes are a list of dep ids, check if this id is in the list -->
|
|
<j:forEach var="exclude" items="${excludeItems}">
|
|
<!-- the exclude could be either the short name (e.g. artifactId), or the id -->
|
|
<j:if test="${(lib.dependency.id == exclude) or (lib.dependency.artifactId == exclude)}">
|
|
<j:set var="excluded" value="true"/>
|
|
</j:if>
|
|
</j:forEach>
|
|
</j:if>
|
|
<j:if test="${!excluded}">
|
|
${includedLibs.add(lib)}
|
|
</j:if>
|
|
</j:forEach>
|
|
<j:if test="${size(includedLibs) != 0}">
|
|
<ant:mkdir dir="${todir}"/>
|
|
<ant:copy todir="${todir}" flatten="true">
|
|
<j:forEach var="lib" items="${includedLibs}">
|
|
<ant:fileset dir="${lib.file.parent}">
|
|
<ant:include name="${lib.file.name}"/>
|
|
</ant:fileset>
|
|
</j:forEach>
|
|
</ant:copy>
|
|
</j:if>
|
|
</define:tag>
|
|
|
|
</define:taglib>
|
|
</project>
|
|
|