lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Find version of Lucene library
Date Wed, 09 Mar 2005 19:46:59 GMT
+1

	Erik

On Mar 9, 2005, at 1:20 PM, Doug Cutting wrote:

> Andrzej Bialecki wrote:
>>> Hmmm... would not java.lang.Package various methods do the job?
>> I'm not sure... I just tried to do 
>> Package.getPackage("org.apache.lucene") and got null, even though the 
>> manifest is present in the JAR.
>
> I looked into this.  The package name in the manifest is 
> "org/apache/lucene".  But in order for this to work the package name 
> in the manifest must: (a) end with a slash; and (b) name a package 
> with classes in it, and lucene's classes are all in sub-packages--no 
> classes are in "org.apache.lucene".
>
> I've attached a patch that fixes (b) by adding a class in the 
> top-level package.  Comments?
>
> Doug
> Index: build.xml
> ===================================================================
> --- build.xml	(revision 156658)
> +++ build.xml	(working copy)
> @@ -189,7 +189,7 @@
>        excludes="**/*.java">
>        <manifest>
>          <attribute name="Created-By" value="Apache Jakarta"/>
> -        <section name="org/apache/lucene">
> +        <section name="org/apache/lucene/">
>            <attribute name="Specification-Title" value="Lucene Search 
> Engine"/>
>            <attribute name="Specification-Version" value="${version}"/>
>            <attribute name="Specification-Vendor" value="Lucene"/>
> Index: src/java/org/apache/lucene/package.html
> ===================================================================
> --- src/java/org/apache/lucene/package.html	(revision 0)
> +++ src/java/org/apache/lucene/package.html	(revision 0)
> @@ -0,0 +1 @@
> +<html><body>Top-level package.</body></html>
> Index: src/java/org/apache/lucene/LucenePackage.java
> ===================================================================
> --- src/java/org/apache/lucene/LucenePackage.java	(revision 0)
> +++ src/java/org/apache/lucene/LucenePackage.java	(revision 0)
> @@ -0,0 +1,28 @@
> +package org.apache.lucene;
> +
> +/**
> + * Copyright 2005 The Apache Software Foundation
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at
> + *
> + *     http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +/** Lucene's package information, including version. **/
> +public final class LucenePackage {
> +
> +  private LucenePackage() {}                      // can't construct
> +
> +  /** Return Lucene's package, including version information. */
> +  public static Package get() {
> +    return LucenePackage.class.getPackage();
> +  }
> +}
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org


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


Mime
View raw message