Fix plugin:download to not delete the plugin just downloaded!

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114473 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
epugh
2003-12-10 21:55:24 +00:00
parent 5f9e553302
commit e50953ba61
4 changed files with 28 additions and 19 deletions

View File

@@ -187,7 +187,9 @@
<echo>repo is '${repo}'</echo>
<u:file var="localPlugin"
name="${maven.home}/plugins/${artifactId}-${version}.jar" />
<j:if test="${!localPlugin.exists()}">
<u:file var="localPluginTempFile"
name="${maven.home}/plugins/plugin.tmp" />
<j:if test="${!localPluginTempFile.exists()}">
<j:set var="remoteFile"
value="${repo}/${groupId}/plugins/${artifactId}-${version}.jar" />
<echo>trying to download ${remoteFile}</echo>
@@ -195,7 +197,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="${localPlugin}"/>
<j:arg type="java.io.File" value="${localPluginTempFile}"/>
<j:arg type="boolean" value="false"/>
<j:arg type="boolean" value="true"/>
<j:arg type="java.lang.String" value="${maven.proxy.host}" />
@@ -206,30 +208,19 @@
</j:invokeStatic>
</j:catch>
</j:if>
<j:break test="${localPlugin.exists()}"/>
<j:break test="${localPluginTempFile.exists()}"/>
</j:forEach>
<j:set var="downloaded" value="${localPlugin.exists()}"/>
<j:set var="downloaded" value="${localPluginTempFile.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>
<echo>Plugin downloaded, removing other versions</echo>\
<delete verbose="false">
<fileset dir="${maven.home}/plugins">
<include name="${artifactId}-*.jar" />
<exclude name="${artifactId}-${version}.jar" />
</fileset>
</delete>
<delete includeEmptyDirs="true" verbose="false">
<fileset dir="${maven.plugin.unpacked.dir}">
<include name="*.cache"/>
<include name="**/.processed" />
<include name="${artifactId}-*/**" />
</fileset>
</delete>
<attainGoal name="plugin:uninstall"/>
<ant:move file="${localPluginTempFile}"
tofile="${localPlugin}" />
</j:if>
</goal>

View File

@@ -33,6 +33,15 @@
<role>Developer</role>
</roles>
</developer>
<developer>
<name>Eric Pugh</name>
<id>epugh</id>
<email>epugh at apache dot org</email>
<organization>OpenSource Connections</organization>
<roles>
<role>Developer</role>
</roles>
</developer>
</developers>
<dependencies>
<dependency>

View File

@@ -7,6 +7,11 @@
<body>
<release version="1.2" date="in CVS">
<action dev="epugh" type="update">
Fixed the plugin:download goal to work. Previously it would delete
the plugin you just downloaded. Also now leverages the plugin:uninstall
goal.
</action>
<action dev="vmassol" type="add">
Added assert:assertEquals tag to verify if two values are equal
while testing a plugin.

View File

@@ -42,6 +42,10 @@
<name>plugin:install</name>
<description>Install the plugin in Maven's plugins dir</description>
</goal>
<goal>
<name>plugin:uninstall</name>
<description>Uninstall all versions of the plugin in Maven's plugins dir</description>
</goal>
<goal>
<name>plugin:test</name>
<description>Run a plugin's test project</description>