Skip to content

Apache Lucene open-source search software

LUCENE-908: - Improves content of MANIFEST file and makes it customizable for the contribs. - Adds SNOWBALL-LICENSE.txt to META-INF of the snowball jar - lucli jar now contains LICENSE.txt and NOTICE.txt.

Michael Busch731fb3a22855
diff --git a/CHANGES.txt b/CHANGES.txt
index a0de18ebaca..d7b4654b5ab 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -271,6 +271,11 @@ Build
7. LUCENE-909: Demo targets for running the demo. (Doron Cohen)
+ 9. LUCENE-908: Improves content of MANIFEST file and makes it customizable
+ for the contribs. Adds SNOWBALL-LICENSE.txt to META-INF of the snowball
+ jar and makes sure that the lucli jar contains LICENSE.txt and NOTICE.txt.
+ (Chris Hostetter, Michael Busch)
+
======================= Release 2.1.0 2007-02-14 =======================
Changes in runtime behavior
diff --git a/build.xml b/build.xml
index 3514b099ec5..904a8ebb32a 100644
--- a/build.xml
+++ b/build.xml
@@ -93,6 +93,23 @@
destfile="${build.dir}/${demo.name}.jar"
basedir="${build.dir}/classes/demo"
excludes="**/*.java">
+ <manifest>
+ <attribute name="Specification-Title" value="Lucene Search Engine: demos"/>
+ <!-- spec version must match "digit+{.digit+}*" -->
+ <attribute name="Specification-Version" value="${version}"/>
+ <attribute name="Specification-Vendor"
+ value="The Apache Software Foundation"/>
+ <attribute name="Implementation-Title" value="org.apache.lucene"/>
+ <!-- impl version can be any string -->
+ <attribute name="Implementation-Version"
+ value="${version}"/>
+ <attribute name="Implementation-Vendor"
+ value="The Apache Software Foundation"/>
+ <attribute name="X-Compile-Source-JDK"
+ value="${javac.source}"/>
+ <attribute name="X-Compile-Target-JDK"
+ value="${javac.target}"/>
+ </manifest>
<metainf dir="${common.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
@@ -106,6 +123,23 @@
<fileset dir="src/jsp" excludes="WEB-INF/web.xml"/>
<lib dir="${build.dir}" includes="${demo.name}.jar"/>
<lib dir="${build.dir}" includes="${final.name}.jar"/>
+ <manifest>
+ <attribute name="Specification-Title" value="Lucene Search Engine: demos"/>
+ <!-- spec version must match "digit+{.digit+}*" -->
+ <attribute name="Specification-Version" value="${version}"/>
+ <attribute name="Specification-Vendor"
+ value="The Apache Software Foundation"/>
+ <attribute name="Implementation-Title" value="org.apache.lucene"/>
+ <!-- impl version can be any string -->
+ <attribute name="Implementation-Version"
+ value="${version}"/>
+ <attribute name="Implementation-Vendor"
+ value="The Apache Software Foundation"/>
+ <attribute name="X-Compile-Source-JDK"
+ value="${javac.source}"/>
+ <attribute name="X-Compile-Target-JDK"
+ value="${javac.target}"/>
+ </manifest>
<metainf dir="${common.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
@@ -113,6 +147,7 @@
</war>
</target>
+
<!-- ================================================================== -->
<!-- B U I L D D E M O -->
<!-- ================================================================== -->
diff --git a/common-build.xml b/common-build.xml
index 81347d75899..aaaf02cb451 100644
--- a/common-build.xml
+++ b/common-build.xml
@@ -45,6 +45,10 @@
<property name="junit.includes" value="**/Test*.java,**/*Test.java"/>
<property name="junit.excludes" value=""/>
+ <patternset id="metainf.includes">
+ <exclude name="**/*"/>
+ </patternset>
+
<condition property="build-1-5-contrib">
<equals arg1="1.5" arg2="${ant.java.version}" />
</condition>
@@ -146,26 +150,70 @@
<target name="jar-core" depends="compile-core"
description="Packages the JAR file">
- <jar
- destfile="${build.dir}/${final.name}.jar"
- basedir="${build.dir}/classes/java">
- <manifest>
- <attribute name="Created-By" value="Apache Lucene Java"/>
- <section name="org/apache/lucene/">
- <attribute name="Specification-Title" value="Lucene Search Engine"/>
+ <jarify />
+ </target>
+
+ <macrodef name="jarify" description="Builds a JAR file">
+ <attribute name="title" default="Lucene Search Engine: ${ant.project.name}" />
+ <element name="manifest-attributes" optional="yes"/>
+ <sequential>
+ <!-- If possible, include the svnversion -->
+ <exec dir="." executable="svnversion"
+ outputproperty="svnversion" failifexecutionfails="false">
+ <arg line="."/>
+ </exec>
+
+ <jar
+ destfile="${build.dir}/${final.name}.jar"
+ basedir="${build.dir}/classes/java">
+ <manifest>
+ <!--
+ http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#JAR%20Manifest
+ http://java.sun.com/j2se/1.5.0/docs/guide/versioning/spec/versioning2.html
+ http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Package.html
+ http://java.sun.com/j2se/1.5.0/docs/api/java/util/jar/package-summary.html
+ http://java.sun.com/developer/Books/javaprogramming/JAR/basics/manifest.html
+ -->
+ <!-- Don't set 'Manifest-Version' it identifies the version of the
+ manifest file format, and should allways be 1.0 (the default)
+
+ Don't set 'Created-by' attribute, it's purpose is
+ to identify the version of java used to build the jar,
+ which ant will do by default.
+
+ Ant will happily override these with bogus strings if you
+ tell it to, so don't.
+
+ NOTE: we don't use section info because all of our manifest data
+ applies to the entire jar/war ... no package specific info.
+ -->
+ <attribute name="Specification-Title" value="@{title}"/>
+ <!-- spec version must match "digit+{.digit+}*" -->
<attribute name="Specification-Version" value="${version}"/>
- <attribute name="Specification-Vendor" value="Lucene"/>
+ <attribute name="Specification-Vendor"
+ value="The Apache Software Foundation"/>
<attribute name="Implementation-Title" value="org.apache.lucene"/>
- <attribute name="Implementation-Version" value="build ${DSTAMP}"/>
- <attribute name="Implementation-Vendor" value="Lucene"/>
- </section>
- </manifest>
- <metainf dir="${common.dir}">
- <include name="LICENSE.txt"/>
- <include name="NOTICE.txt"/>
- </metainf>
- </jar>
- </target>
+ <!-- impl version can be any string -->
+ <attribute name="Implementation-Version"
+ value="${version} ${svnversion} - ${user.name} - ${DSTAMP} ${TSTAMP}"/>
+ <attribute name="Implementation-Vendor"
+ value="The Apache Software Foundation"/>
+ <attribute name="X-Compile-Source-JDK"
+ value="${javac.source}"/>
+ <attribute name="X-Compile-Target-JDK"
+ value="${javac.target}"/>
+ <manifest-attributes/>
+ </manifest>
+ <metainf dir="${common.dir}">
+ <include name="LICENSE.txt"/>
+ <include name="NOTICE.txt"/>
+ </metainf>
+ <metainf dir=".">
+ <patternset refid="metainf.includes"/>
+ </metainf>
+ </jar>
+ </sequential>
+ </macrodef>
<target name="compile-test" depends="compile-core">
<compile
@@ -344,3 +392,4 @@
+
diff --git a/contrib/lucli/META-INF/MANIFEST.MF b/contrib/lucli/META-INF/MANIFEST.MF
deleted file mode 100644
index 38844b37950..00000000000
--- a/contrib/lucli/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,2 +0,0 @@
-Main-Class: lucli.Lucli
-Class-Path: lib/jline.jar lib/lucene.jar
diff --git a/contrib/lucli/build.xml b/contrib/lucli/build.xml
index dbd7e7a131f..ca062da40ad 100644
--- a/contrib/lucli/build.xml
+++ b/contrib/lucli/build.xml
@@ -22,9 +22,11 @@
<import file="../contrib-build.xml"/>
<target name="jar" depends="compile" description="Create JAR">
- <jar jarfile="${build.dir}/${final.name}.jar"
- basedir="${build.dir}/classes/java"
- manifest="META-INF/MANIFEST.MF"
- />
+ <jarify>
+ <manifest-attributes>
+ <attribute name="Main-Class" value="lucli.Lucli" />
+ <attribute name="Class-Path" value="lib/jline.jar lib/lucene.jar" />
+ </manifest-attributes>
+ </jarify>
</target>
</project>
diff --git a/contrib/snowball/build.xml b/contrib/snowball/build.xml
index 0a2eb662565..69b23c74f08 100644
--- a/contrib/snowball/build.xml
+++ b/contrib/snowball/build.xml
@@ -13,6 +13,9 @@
<property name="snowball.root" value="snowball/website"/>
<property name="bin.dir" location="bin"/>
+ <patternset id="metainf.includes">
+ <include name="SNOWBALL-LICENSE.txt"/>
+ </patternset>
<!-- ====================================================== -->
<!-- Download Snowball code -->
diff --git a/src/demo/demo-build.template b/src/demo/demo-build.template
index da4197356b3..e9a2e5a60ad 100644
--- a/src/demo/demo-build.template
+++ b/src/demo/demo-build.template
@@ -50,6 +50,23 @@
destfile="${demo.name}.jar"
basedir="${build.dir}/classes/demo"
excludes="**/*.java">
+ <manifest>
+ <attribute name="Specification-Title" value="Lucene Search Engine: demos"/>
+ <!-- spec version must match "digit+{.digit+}*" -->
+ <attribute name="Specification-Version" value="${version}"/>
+ <attribute name="Specification-Vendor"
+ value="The Apache Software Foundation"/>
+ <attribute name="Implementation-Title" value="org.apache.lucene"/>
+ <!-- impl version can be any string -->
+ <attribute name="Implementation-Version"
+ value="${version}"/>
+ <attribute name="Implementation-Vendor"
+ value="The Apache Software Foundation"/>
+ <attribute name="X-Compile-Source-JDK"
+ value="${javac.source}"/>
+ <attribute name="X-Compile-Target-JDK"
+ value="${javac.target}"/>
+ </manifest>
<metainf dir="${common.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
@@ -64,6 +81,23 @@
<fileset dir="src/jsp" excludes="WEB-INF/web.xml"/>
<lib dir="." includes="${demo.name}.jar"/>
<lib dir="." includes="${core.name}.jar"/>
+ <manifest>
+ <attribute name="Specification-Title" value="Lucene Search Engine: demos"/>
+ <!-- spec version must match "digit+{.digit+}*" -->
+ <attribute name="Specification-Version" value="${version}"/>
+ <attribute name="Specification-Vendor"
+ value="The Apache Software Foundation"/>
+ <attribute name="Implementation-Title" value="org.apache.lucene"/>
+ <!-- impl version can be any string -->
+ <attribute name="Implementation-Version"
+ value="${version}"/>
+ <attribute name="Implementation-Vendor"
+ value="The Apache Software Foundation"/>
+ <attribute name="X-Compile-Source-JDK"
+ value="${javac.source}"/>
+ <attribute name="X-Compile-Target-JDK"
+ value="${javac.target}"/>
+ </manifest>
<metainf dir="${common.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>