lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Janssen <jans...@parc.com>
Subject Re: two versioning problems with Lucene
Date Tue, 07 Dec 2004 16:42:38 GMT
So if we keep the Lucene version in only the packaging of the jar
file, we have a source of end-user error and fragility in two ways:
(1) the manifest file may not be available (the class files may be
re-packaged in another app which didn't know to copy the Lucene
manifest stuff, or unpacked), and (2) since the version is a string
which must be parsed correctly, the application could error in that
process, and wind up with incorrect version numbers.

Both of these error conditions could be eliminated with a simple class
created at build time and added to the org.apache.lucene package:

package org.apache.lucene;
public class VERSION {

   public static final int majorVersion = 1;
   public static final int minorVersion = 4;
   public static final int microVersion = 3;

   public static final int indexFormatVersion = 3;

   public static boolean canWorkWith (File indexDirectory) {
      // some code here to tell whether it can understand
      // this index version
   }
}

Why make life tough on users?

Bill

> On Dec 7, 2004, at 12:42 PM, Bill Janssen wrote:
> >> We could easily store the version number in a Java static variable
> >> somewhere, but let's first explore whether the manifest information is
> >> sufficient.
> >
> > Will this work in the face of re-packaging?  For instance, suppose I
> > unpack the class files from the jar file and use them directly?  Or
> > then re-package them into a different jar file along with my set of
> > classes?
> 
> It would only work if you kept the manifest entries (see Lucene's build 
> file or the manifest itself for details).
> 
> It could be argued that if you repackage that the version number is not 
> a reliable number, or at least it should also be noted that its not 
> *exactly* the same version of Lucene as the official binary download 
> JAR file.
> 
> 	Erik
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
> 


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


Mime
View raw message