brett       2004/03/24 21:33:11

  Modified:    src/java/org/apache/maven/plugin Tag: MAVEN-1_0-BRANCH
                        PluginCacheManager.java
  Log:
  fix problems with cache being corrupted by Ctrl-C'ing Maven
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.16.4.8  +12 -0     maven/src/java/org/apache/maven/plugin/PluginCacheManager.java
  
  Index: PluginCacheManager.java
  ===================================================================
  RCS file: /home/cvs/maven/src/java/org/apache/maven/plugin/PluginCacheManager.java,v
  retrieving revision 1.16.4.7
  retrieving revision 1.16.4.8
  diff -u -r1.16.4.7 -r1.16.4.8
  --- PluginCacheManager.java   23 Mar 2004 23:35:35 -0000      1.16.4.7
  +++ PluginCacheManager.java   25 Mar 2004 05:33:11 -0000      1.16.4.8
  @@ -46,6 +46,9 @@
       /** Maven session log */
       private static final Log sessionLog = LogFactory.getLog(MavenSession.class);
   
  +    /** Plug-in cache valid. */
  +    public static final String VALID_CACHE = "valid.cache";
  +
       /** Plug-in cache */
       public static final String PLUGINS_CACHE = "plugins.cache";
   
  @@ -127,11 +130,14 @@
              log.debug( "Saving caches to " + directory.getAbsolutePath() );
           }
   
  +        File f = new File( directory, VALID_CACHE );
  +        f.delete();
           storeProperties(pluginCache, new File( directory, PLUGINS_CACHE ), "plugins 
cache");
           storeProperties(goalCache, new File( directory, GOALS_CACHE ), "goals 
cache");
           storeProperties(callbackCache, new File( directory, CALLBACKS_CACHE ), 
"callbacks cache");
           storeProperties(dynaTagLibCache, new File( directory, DYNAMIC_TAGLIBS_CACHE 
), "taglibs cache");
           storeProperties(pluginDynaTagDepsCache, new File( directory, 
PLUGIN_DYNATAG_DEPS_CACHE ), "plugin deps cache");
  +        f.createNewFile();
       }
   
       /**
  @@ -182,6 +188,12 @@
        */
       void loadCache( File directory )
       {
  +        File f = new File( directory, VALID_CACHE );
  +        if ( !f.exists() )
  +        {
  +            log.info( "Plugin cache will be regenerated" );
  +            return;
  +        }
           pluginCache = loadProperties( new File( directory, PLUGINS_CACHE ) );
           goalCache = loadProperties( new File( directory, GOALS_CACHE ) );
           callbackCache = loadProperties( new File( directory, CALLBACKS_CACHE ) );
  
  
  

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

Reply via email to