split plugin:download goal

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114767 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
brett
2004-03-02 00:17:25 +00:00
parent bdbf6189eb
commit 64883a0a37
2 changed files with 23 additions and 22 deletions

View File

@@ -175,22 +175,26 @@
</j:if>
</goal>
<goal name="plugin:download" description="download and install a plugin from a remote repo" prereqs="plugin:download-artifact">
<attainGoal name="plugin:uninstall"/>
<u:file var="localPlugin" name="${maven.home}/plugins/${artifactId}-${version}.jar" />
<ant:copy file="${localPluginFile}" tofile="${localPlugin}" />
</goal>
<!-- download a plugin from a remote repo -->
<goal name="plugin:download" description="download a plugin from a remote repo">
<goal name="plugin:download-artifact" description="download a plugin from a remote repo">
<maven:param-check value="${artifactId}" fail="true" message="'artifactId' must be specified"/>
<maven:param-check value="${groupId}" fail="true" message="'groupId' must be specified"/>
<maven:param-check value="${version}" fail="true" message="'version' must be specified"/>
<j:set var="repoList">${maven.repo.remote}</j:set>
<u:tokenize var="repos" delim=",">${repoList.trim()}</u:tokenize>
<u:file var="localPluginFile"
name="${maven.repo.local}/${groupId}/plugins/${artifactId}-${version}.jar" />
<j:if test="${!localPluginFile.exists()}">
<j:set var="repoList">${maven.repo.remote}</j:set>
<u:tokenize var="repos" delim=",">${repoList.trim()}</u:tokenize>
<j:forEach var="repo" items="${repos}">
<echo>repo is '${repo}'</echo>
<u:file var="localPlugin"
name="${maven.home}/plugins/${artifactId}-${version}.jar" />
<u:file var="localPluginTempFile"
name="${maven.home}/plugins/plugin.tmp" />
<j:if test="${!localPluginTempFile.exists()}">
<j:forEach var="repo" items="${repos}">
<echo>repo is '${repo}'</echo>
<j:set var="remoteFile"
value="${repo}/${groupId}/plugins/${artifactId}-${version}.jar" />
<echo>trying to download ${remoteFile}</echo>
@@ -198,7 +202,7 @@
<j:invokeStatic var="dummy" method="getFile"
className="org.apache.maven.util.HttpUtils">
<j:arg type="java.lang.String" value="${remoteFile}" />
<j:arg type="java.io.File" value="${localPluginTempFile}"/>
<j:arg type="java.io.File" value="${localPluginFile}"/>
<j:arg type="boolean" value="false"/>
<j:arg type="boolean" value="true"/>
<j:arg type="java.lang.String" value="${maven.proxy.host}" />
@@ -208,21 +212,14 @@
<j:arg type="boolean" value="false"/>
</j:invokeStatic>
</j:catch>
</j:if>
<j:break test="${localPluginTempFile.exists()}"/>
</j:forEach>
<j:break test="${localPluginFile.exists()}"/>
</j:forEach>
</j:if>
<j:set var="downloaded" value="${localPluginTempFile.exists()}"/>
<j:set var="downloaded" value="${localPluginFile.exists()}"/>
<j:if test="${!downloaded}">
<ant:fail message="Unable to find plug-in" />
</j:if>
<j:if test="${downloaded}">
<echo>Plugin downloaded, removing other versions</echo>\
<attainGoal name="plugin:uninstall"/>
<ant:move file="${localPluginTempFile}"
tofile="${localPlugin}" />
</j:if>
</goal>
<!--

View File

@@ -26,6 +26,10 @@
<action dev="brett" type="add">
Add plugin:repository-deploy goal
</action>
<action dev="brett" type="update">
Split plugin:download goal into plugin:download-artifact goal and the original goal that downloads
and installs the plugin. Download to local repository as well.
</action>
</release>
<release version="1.1" date="2003-09-29">