You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ji...@codehaus.org on 2004/12/09 22:49:57 UTC

[jira] Created: (MPPLUGIN-31) Add a goal for uninstalling dependancy plugins

Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/MPPLUGIN-31

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MPPLUGIN-31
    Summary: Add a goal for uninstalling dependancy plugins
       Type: Wish

     Status: Open
   Priority: Minor

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: maven-plugin-plugin

   Assignee: dion gillard
   Reporter: Eric Black

    Created: Thu, 9 Dec 2004 4:49 PM
    Updated: Thu, 9 Dec 2004 4:49 PM
Environment: Linux

Description:
I was having a problem with devising a plan for developers in my group to automatically install plugins, and through the user group mailing list, I got some help getting it to work. The following is the last email I sent regarding auto uninstalling the plugins to get a newer version:

 I used the dependency method, which I found to be much superior to plugin:download or plugin:install since a user may not have permissions to install a plugin into the MAVEN_HOME/plugins directory. With the dependency method, I found it difficult to upgrade the plugin unless I manually deleted what was installed or specified SNAPSHOT as the version. After reading some older mailings(specifically between Ben Gridley and Brett Porter), I used modified Ben's script as follows:


<?xml version="1.0"?>

<project 
  xmlns:j="jelly:core"
  xmlns:ant="jelly:ant">

  <goal name="ccplugin:delete">
    <j:forEach var="dep" items="${pom.dependencies}">
      <j:if test="${dep.type =='plugin'}">
        <!--
        <maven:get plugin="${dep.artifactId}" property="plugin" var="plugin" />
        -->
        <!-- Clean out the cache files -->
        <attainGoal name="plugin:uninstall" />                                  

        <!-- Set the variables -->
        <j:set var="groupId" value="${dep.groupId}"/>
        <j:set var="artifactId" value="${dep.artifactId}"/>
        <j:set var="version" value="${dep.version}"/>
        <j:set var="pluginname" value="${artifactId}-${version}"/>
        
        <!-- Check if the plugin is in the main maven plugins directory -->
        <ant:available property="mainplugin" file="${maven.plugin.dir}/${pluginname}.jar" />
        <j:if test="${mainplugin == 'true'}">
          <ant:echo message="${maven.plugin.dir}/${pluginname}.jar is in the main maven plugins directory" />
          <!-- This is kindof dangerous as it would effect all users and may fail if not owned by the user -->
          <ant:delete file="${maven.plugin.dir}/${pluginname}.jar" />"
        </j:if>

        <!-- Remove from the user's plugin directory. -->
        <ant:available property="userplugin" file="${maven.plugin.user.dir}/${pluginname}.jar" />
        <j:if test="${userplugin == 'true'}">
          <ant:echo message="Removing '${pluginname}' from '${maven.plugin.dir}'" />
          <ant:delete file="${maven.plugin.user.dir}/${pluginname}.jar" />"
        </j:if>

        <!-- Remove from the user's cache directory. This isn't really necessary since we'll delete 
             the jar in the repository which will cause the plugin to be re-downloaded --> 
        <ant:available property="usercache" file="${maven.plugin.unpacked.dir}/${pluginname}" />
        <j:if test="${usercache == 'true'}">
          <ant:echo message="Removing ${pluginname} from ${maven.plugin.unpacked.dir}" />
          <ant:delete dir="${maven.plugin.unpacked.dir}/${pluginname}" includeEmptyDirs="true" />
        </j:if>

        <!-- Remove from the user's repository directory. -->
        <ant:available property="userrepoplugin" file="${maven.repo.local}/${groupId}/plugins/${pluginname}.jar" />
        <j:if test="${userrepoplugin == 'true'}">
          <ant:echo message="Removing '${pluginname}' from '${maven.repo.local}'" />
          <ant:delete file="${maven.repo.local}/${groupId}/plugins/${pluginname}.jar" />
        </j:if> 

      </j:if>
    </j:forEach>                
  </goal>
</project>

I think this kind of functionality might be useful in the main Maven plugin plugin.


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org