git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115481 13f79535-47bb-0310-9956-ffa450edef68
338 lines
12 KiB
XML
338 lines
12 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"
|
|
>
|
|
|
|
|
|
<define:taglib uri="artifact">
|
|
|
|
|
|
<!-- For times the same bean is used. -->
|
|
|
|
|
|
<define:jellybean
|
|
name="install"
|
|
method="install"
|
|
className="org.apache.maven.artifact.deployer.DeployBean"/>
|
|
|
|
|
|
<define:jellybean
|
|
name="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="deploy">
|
|
<artifact:check-legacy var="legacy" />
|
|
|
|
<j:choose>
|
|
<j:when test="${legacy}">
|
|
<maven:makeRelativePath basedir="${basedir}" var="artifact" path="${artifact}" separator="/" />
|
|
<util:file var="f" name="${artifact}" />
|
|
<deploy:artifact
|
|
assureDirectoryCommand="mkdir -p"
|
|
type="${type}"
|
|
artifact="${artifact}"
|
|
siteCommand="cd @deployDirectory@; chmod g+w ${f.name}; chgrp ${maven.remote.group} ${f.name}"
|
|
/>
|
|
</j:when>
|
|
<j:otherwise>
|
|
<artifact:artifact-deploy
|
|
project="${project}"
|
|
type="${type}"
|
|
artifact="${artifact}"
|
|
/>
|
|
</j:otherwise>
|
|
</j:choose>
|
|
</define:tag>
|
|
|
|
<define:tag name="deploy-snapshot">
|
|
<artifact:check-legacy var="legacy" />
|
|
|
|
<j:choose>
|
|
<j:when test="${legacy}">
|
|
<!-- TODO: what about -snapshot-versioa, SNAPSHOT symlink? -->
|
|
<!-- TODO: make artifact a relative path -->
|
|
<maven:makeRelativePath basedir="${basedir}" var="artifact" path="${artifact}" separator="/" />
|
|
<util:file var="f" name="${artifact}" />
|
|
<deploy:artifact
|
|
assureDirectoryCommand="mkdir -p"
|
|
type="${type}"
|
|
artifact="${artifact}"
|
|
siteCommand="cd @deployDirectory@; chmod g+w ${f.name}; chgrp ${maven.remote.group} ${f.name}"
|
|
/>
|
|
</j:when>
|
|
<j:otherwise>
|
|
<artifact:artifact-deploy-snapshot
|
|
project="${project}"
|
|
type="${type}"
|
|
artifact="${artifact}"
|
|
/>
|
|
</j:otherwise>
|
|
</j:choose>
|
|
</define:tag>
|
|
|
|
<define:tag name="check-legacy">
|
|
<j:choose>
|
|
<j:when test="${context.getVariable('maven.artifact.legacy') == 'true'}">
|
|
<ant:echo>maven.artifact.legacy is set to true - using legacy deploy mode</ant:echo>
|
|
<j:set var="${var}" value="true" scope="parent" />
|
|
</j:when>
|
|
<j:when test="${context.getVariable('maven.artifact.legacy') == 'false'}">
|
|
<ant:echo>maven.artifact.legacy is set to false - using artifact deploy mode</ant:echo>
|
|
</j:when>
|
|
<j:when test="${context.getVariable('maven.repo.list') == null}">
|
|
<ant:echo>maven.repo.list is not set - using legacy deploy mode</ant:echo>
|
|
<j:set var="${var}" value="true" scope="parent" />
|
|
</j:when>
|
|
<j:otherwise>
|
|
<ant:echo>maven.repo.list is set - using artifact deploy mode</ant:echo>
|
|
</j:otherwise>
|
|
</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:taglib>
|
|
|
|
<goal name="artifact:load">
|
|
<ant:echo>
|
|
DEPRECATED: you do not need to use artifact:load for plugin dependencies. Instead, use the
|
|
xmlns:artifact="artifact" notation
|
|
</ant:echo>
|
|
</goal>
|
|
|
|
<!--
|
|
|
|
|
| FIX ME: It is the additional siteCommand options that is causing the
|
|
| deploy:artifact tag to hang indefinitely.
|
|
|
|
|
| FIX ME: Deprecate these tags
|
|
|
|
|
-->
|
|
|
|
<!-- ================================================================== -->
|
|
<!-- 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">
|
|
|
|
<!--
|
|
||
|
|
|| If the ${maven.username} value isn't set then the deployment
|
|
|| process fails.
|
|
||
|
|
-->
|
|
|
|
<j:set var="username" value='${context.getVariable("maven.username")}'/>
|
|
|
|
<maven:user-check user="${username}"/>
|
|
|
|
<j:set var="copier" value='${context.getVariable("maven.scp.executable")}'/>
|
|
<j:set var="commander" value='${context.getVariable("maven.ssh.executable")}'/>
|
|
|
|
<j:set var="distributionSiteX" value="${pom.distributionSite}X"/>
|
|
<j:choose>
|
|
<j:when test="${distributionSiteX != 'X'}">
|
|
<j:set var="siteAddress" value="${pom.distributionSite}"/>
|
|
<j:set var="siteDirectory" value="${pom.distributionDirectory}"/>
|
|
</j:when>
|
|
<j:otherwise>
|
|
<j:set var="siteAddress" value='${context.getVariable("maven.repo.central")}'/>
|
|
<j:set var="siteDirectory" value='${context.getVariable("maven.repo.central.directory")}'/>
|
|
</j:otherwise>
|
|
</j:choose>
|
|
|
|
<j:set var="typeX" value="${type}X"/>
|
|
<j:choose>
|
|
<j:when test="${typeX != 'X'}">
|
|
<j:set
|
|
var="resolvedDirectory"
|
|
value="${siteDirectory}/${pom.artifactDirectory}/${type}"
|
|
/>
|
|
</j:when>
|
|
<j:otherwise>
|
|
<j:set
|
|
var="resolvedDirectory"
|
|
value="${siteDirectory}/${pom.artifactDirectory}"
|
|
/>
|
|
</j:otherwise>
|
|
</j:choose>
|
|
|
|
<ant:echo>
|
|
Moving ${artifact} to the ${resolvedDirectory} on ${siteAddress}
|
|
</ant:echo>
|
|
|
|
<!--
|
|
||
|
|
|| Make sure the destination directory exists.
|
|
||
|
|
-->
|
|
|
|
<j:set var="assureDirectoryCommandX" value="${assureDirectoryCommand}X"/>
|
|
<j:if test="${assureDirectoryCommandX != 'X'}">
|
|
<ant:exec dir="." executable="${commander}">
|
|
<ant:arg line="${maven.ssh.args} -l ${username} ${siteAddress} '${assureDirectoryCommand} ${resolvedDirectory}'"/>
|
|
</ant:exec>
|
|
</j:if>
|
|
|
|
<ant:exec dir="." executable="${copier}">
|
|
<ant:arg line="${maven.scp.args} ${artifact} ${username}@${siteAddress}:${resolvedDirectory}"/>
|
|
</ant:exec>
|
|
|
|
<!--
|
|
||
|
|
|| Execute a command on the server if one is specified.
|
|
||
|
|
-->
|
|
|
|
<j:set var="siteCommandX" value="${siteCommand}X"/>
|
|
<j:if test="${siteCommandX != 'X'}">
|
|
|
|
<j:useBean var="strings" class="org.apache.commons.lang.StringUtils"/>
|
|
|
|
<j:set
|
|
var="siteCommand"
|
|
value='${strings.replace(siteCommand, "@deployDirectory@", resolvedDirectory)}'
|
|
/>
|
|
|
|
<ant:echo>
|
|
Executing ${siteCommand} with the username ${username} on ${siteAddress}
|
|
</ant:echo>
|
|
|
|
<ant:exec dir="." executable="${commander}">
|
|
<ant:arg line="${maven.ssh.args} -l ${username} ${siteAddress} '${siteCommand}'"/>
|
|
</ant:exec>
|
|
|
|
</j:if>
|
|
|
|
</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")}'/>
|
|
<ant:mkdir dir="${todir}"/>
|
|
<ant:copy todir="${todir}" flatten="true">
|
|
<!-- 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>
|
|
|
|
<!--
|
|
! 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}">
|
|
<ant:fileset dir="${lib.file.parent}">
|
|
<ant:include name="${lib.file.name}"/>
|
|
</ant:fileset>
|
|
</j:if>
|
|
</j:forEach>
|
|
</ant:copy>
|
|
</define:tag>
|
|
|
|
</define:taglib>
|
|
</project>
|
|
|