brett       2003/08/31 00:35:20

  Modified:    src/java/org/apache/maven/plugin PluginManager.java
  Log:
  Check if loaded before installing again. Remove comments about caching - have 
verified that it is necessary.
  
  Revision  Changes    Path
  1.65      +15 -15    maven/src/java/org/apache/maven/plugin/PluginManager.java
  
  Index: PluginManager.java
  ===================================================================
  RCS file: /home/cvs/maven/src/java/org/apache/maven/plugin/PluginManager.java,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- PluginManager.java        25 Aug 2003 04:22:17 -0000      1.64
  +++ PluginManager.java        31 Aug 2003 07:35:20 -0000      1.65
  @@ -1023,8 +1023,6 @@
   
       /**
        * Load and install a plugin
  -     * @todo should check if it's already installed.
  -     * @todo I'm not sure if caching needs to be called.
        * @param file the file to install. Must be a plugin jar
        * @param project the project to load the installed plugin into
        * @throws Exception when unzipping fails
  @@ -1035,17 +1033,19 @@
           FileUtils.copyFileToDirectory(file, getPluginsDir());
           String pluginName = file.getCanonicalFile().getName();
           pluginName = pluginName.substring(0, pluginName.indexOf(".jar"));
  -        String newFileName = getPluginsDir().getCanonicalPath()
  -            + File.separator + file.getCanonicalFile().getName();
  -        // expand it
  -        Expand unzipper = new Expand();
  -        unzipper.setSrc( new File(newFileName));
  -        File unzipDir = new File( getUnpackedPluginsDir(), pluginName);
  -        unzipper.setDest( unzipDir );
  -        unzipper.execute();
  -        // load it
  -        loadPlugin(pluginName, project);
  -        cachePlugin(pluginName);
  -        // FIXME: Does it need caching too?
  +        if ( !isLoaded( project, pluginName )) 
  +        {
  +            String newFileName = getPluginsDir().getCanonicalPath()
  +                + File.separator + file.getCanonicalFile().getName();
  +            // expand it
  +            Expand unzipper = new Expand();
  +            unzipper.setSrc( new File( newFileName ));
  +            File unzipDir = new File( getUnpackedPluginsDir(), pluginName );
  +            unzipper.setDest( unzipDir );
  +            unzipper.execute();
  +            // load it
  +            loadPlugin( pluginName, project );
  +            cachePlugin( pluginName );
  +        }
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to