Remove other versions of the same plugin, like plugin:install does
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114033 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
a71c34d6b9
commit
6bc25f0344
1 file changed
+22
-2
+22
-2
@@ -175,21 +175,22 @@
|
||||
<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>
|
||||
|
||||
<j:forEach var="repo" items="${repos}">
|
||||
<echo>repo is '${repo}'</echo>
|
||||
<u:file var="localPlugin"
|
||||
name="${maven.home}/plugins/${artifactId}-${version}.jar" />
|
||||
<j:if test="${!localPlugin.exists()}">
|
||||
<u:file var="localPluginFile" name="${localPlugin}"/>
|
||||
<j:set var="remoteFile"
|
||||
value="${repo}/${groupId}/plugins/${artifactId}-${version}.jar" />
|
||||
<echo>trying to download ${remoteFile}</echo>
|
||||
<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="${localPluginFile}"/>
|
||||
<j:arg type="java.io.File" value="${localPlugin}"/>
|
||||
<j:arg type="boolean" value="false"/>
|
||||
<j:arg type="boolean" value="true"/>
|
||||
<j:arg type="java.lang.String" value="${maven.proxy.host}" />
|
||||
@@ -200,5 +201,24 @@
|
||||
</j:invokeStatic>
|
||||
</j:if>
|
||||
</j:forEach>
|
||||
|
||||
<j:set var="downloaded" value="${localPlugin.exists()}"/>
|
||||
<j:if test="${downloaded}">
|
||||
<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>
|
||||
</j:if>
|
||||
</goal>
|
||||
</project>
|
||||
Reference in new issue
Block a user