git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113765 13f79535-47bb-0310-9956-ffa450edef68
165 lines
5.8 KiB
XML
165 lines
5.8 KiB
XML
<?xml version="1.0"?>
|
|
|
|
<project
|
|
xmlns:j="jelly:core"
|
|
xmlns:ant="jelly:ant"
|
|
xmlns:maven="jelly:maven"
|
|
xmlns:define="jelly:define"
|
|
xmlns:deploy="deploy"
|
|
xmlns:util="jelly:util"
|
|
xmlns:log="jelly:log">
|
|
|
|
<!--
|
|
|
|
|
| FIX ME: It is the additional siteCommand options that is causing the
|
|
| deploy:artifact tag to hang indefinitely.
|
|
|
|
|
-->
|
|
|
|
<!-- ================================================================== -->
|
|
<!-- 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'}">
|
|
<ant:property
|
|
name="resolvedDirectory"
|
|
value="${siteDirectory}/${pom.artifactDirectory}/${type}"
|
|
/>
|
|
</j:when>
|
|
<j:otherwise>
|
|
<ant:property
|
|
name="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="-l ${username} ${siteAddress} '${assureDirectoryCommand} ${resolvedDirectory}'"/>
|
|
</ant:exec>
|
|
</j:if>
|
|
|
|
<ant:exec dir="." executable="${copier}">
|
|
<ant:arg value="${artifact}"/>
|
|
<ant:arg value="${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="-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">
|
|
<ant:fileset dir="${mavenRepoLocal}">
|
|
<!-- FIXME: should use pom.artifacts -->
|
|
<j:forEach var="dep" items="${pom.dependencies}">
|
|
<ant:include name="${dep.artifactDirectory}/jars/${dep.artifact}"/>
|
|
</j:forEach>
|
|
<j:if test="${excludes != ''}">
|
|
<!-- The excludes are a list of dep ids -->
|
|
<util:tokenize var="excludeItems" delim=",">${excludes}</util:tokenize>
|
|
<j:forEach var="exclude" items="${excludeItems}">
|
|
<j:set var="depToExclude" value="${pom.getDependency(exclude)}"/>
|
|
<ant:exclude name="${depToExclude.artifactDirectory}/jars/${depToExclude.artifact}"/>
|
|
</j:forEach>
|
|
</j:if>
|
|
</ant:fileset>
|
|
</ant:copy>
|
|
</define:tag>
|
|
|
|
</define:taglib>
|
|
|
|
</project>
|