- LUCENE-908: Improvements and simplifications for how the MANIFEST file and the META-INF dir are created.

- LUCENE-935: Various improvements for the maven artifacts. Now the artifacts also include the sources as .jar files. 

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@568766 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Busch 2007-08-22 23:16:48 +00:00
parent 27c4c6a3b1
commit 9c2a036db3
29 changed files with 212 additions and 181 deletions

View File

@ -135,6 +135,13 @@ Documentation
Build
1. LUCENE-908: Improvements and simplifications for how the MANIFEST
file and the META-INF dir are created. (Michael Busch)
2. LUCENE-935: Various improvements for the maven artifacts. Now the
artifacts also include the sources as .jar files. (Michael Busch)
Test Cases
======================= Release 2.2.0 2007-06-19 =======================

View File

@ -106,62 +106,51 @@
<!-- ================================================================== -->
<target name="jar-demo" depends="compile-demo">
<sequential>
<build-manifest title="Lucene Search Engine: demos"/>
<jar
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>
excludes="**/*.java"
manifest="${manifest.file}">
<metainf dir="${common.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
</jar>
</sequential>
</target>
<target name="jar-demo-src" depends="compile-demo">
<sequential>
<build-manifest title="Lucene Search Engine: demos"/>
<jar
destfile="${build.dir}/${demo.name}-src.jar"
basedir="src/demo"
manifest="${manifest.file}">
<metainf dir="${common.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
</jar>
</sequential>
</target>
<target name="war-demo" depends="jar-core,jar-demo">
<sequential>
<build-manifest title="Lucene Search Engine: demos"/>
<war destfile="${build.dir}/${demo.war.name}.war"
webxml="src/jsp/WEB-INF/web.xml">
webxml="src/jsp/WEB-INF/web.xml"
manifest="${manifest.file}">
<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"/>
</metainf>
</war>
</sequential>
</target>
@ -361,12 +350,24 @@
<target name="dist-all" depends="dist, dist-src"/>
<target name="generate-maven-artifacts" depends="maven.ant.tasks-check, package">
<target name="generate-maven-artifacts" depends="maven.ant.tasks-check, package, jar-src, jar-demo-src">
<sequential>
<m2-deploy pom.xml="lucene-parent-pom.xml"/>
<m2-deploy pom.xml="lucene-core-pom.xml"/>
<m2-deploy pom.xml="lucene-demos-pom.xml"/>
<m2-deploy pom.xml="lucene-contrib-pom.xml"/>
<m2-deploy pom.xml="lucene-parent-pom.xml.template"/>
<m2-deploy pom.xml="lucene-core-pom.xml.template">
<artifact-attachments>
<attach file="${build.dir}/${final.name}-src.jar"
classifier="sources"/>
</artifact-attachments>
</m2-deploy>
<m2-deploy pom.xml="lucene-demos-pom.xml.template">
<artifact-attachments>
<attach file="${build.dir}/${demo.name}-src.jar"
classifier="sources"/>
</artifact-attachments>
</m2-deploy>
<m2-deploy pom.xml="lucene-contrib-pom.xml.template"/>
<contrib-crawl target="dist-maven"/>
<!-- do md5 checksums -->
<checksum forceOverwrite="yes" fileext=".md5">

View File

@ -65,13 +65,7 @@
<property name="junit.includes" value="**/Test*.java,**/*Test.java"/>
<property name="junit.excludes" value=""/>
<patternset id="metainf.includes">
<!-- use an explicit include to prevent expensive walking of subdirs
that default include triggers
-->
<include name="FIND_NOTHING"/>
<exclude name="**/*"/>
</patternset>
<property name="manifest.file" location="${common.dir}/build/MANIFEST.MF"/>
<condition property="build-1-5-contrib">
<equals arg1="1.5" arg2="${ant.java.version}" />
@ -220,7 +214,7 @@
<target name="jar-core" depends="compile-core"
description="Packages the JAR file">
<jarify />
<jarify/>
</target>
<target name="maven.ant.tasks-check">
@ -233,9 +227,10 @@
</fail>
</target>
<property name="pom.xml" value="pom.xml"/>
<property name="pom.xml" value="pom.xml.template"/>
<macrodef name="m2-deploy" description="Builds a Maven artifact">
<element name="artifact-attachments" optional="yes"/>
<attribute name="pom.xml" default="${pom.xml}"/>
<sequential>
<copy file="@{pom.xml}" tofile="${build.dir}/@{pom.xml}">
@ -243,49 +238,22 @@
<filter token="version" value="${version}"/>
</filterset>
</copy>
<artifact:pom id="maven.project" file="${build.dir}/@{pom.xml}" />
<artifact:install file="${build.dir}/${maven.project.build.finalName}.jar">
<localRepository location="${maven.dist.dir}"/>
<artifact:deploy file="${build.dir}/${maven.project.build.finalName}.jar">
<artifact-attachments/>
<remoteRepository url="file://${maven.dist.dir}"/>
<pom refid="maven.project"/>
</artifact:install>
</artifact:deploy>
</sequential>
</macrodef>
<macrodef name="jarify" description="Builds a JAR file">
<macrodef name="build-manifest" description="Builds a manifest 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.
-->
<manifest file="${manifest.file}">
<attribute name="Specification-Title" value="@{title}"/>
<!-- spec version must match "digit+{.digit+}*" -->
<attribute name="Specification-Version" value="${version}"/>
@ -301,15 +269,36 @@
value="${javac.source}"/>
<attribute name="X-Compile-Target-JDK"
value="${javac.target}"/>
</manifest>
</sequential>
</macrodef>
<macrodef name="jarify" description="Builds a JAR file">
<attribute name="basedir" default="${build.dir}/classes/java"/>
<attribute name="destfile" default="${build.dir}/${final.name}.jar"/>
<element name="manifest-attributes" optional="yes"/>
<element name="metainf-includes" optional="yes"/>
<sequential>
<!-- If possible, include the svnversion -->
<exec dir="." executable="svnversion"
outputproperty="svnversion" failifexecutionfails="false">
<arg line="."/>
</exec>
<build-manifest/>
<jar
destfile="@{destfile}"
basedir="@{basedir}"
manifest="${manifest.file}">
<manifest>
<manifest-attributes/>
</manifest>
<metainf dir="${common.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
<metainf dir=".">
<patternset refid="metainf.includes"/>
</metainf>
<metainf-includes/>
</jar>
</sequential>
</macrodef>
@ -445,9 +434,7 @@
</target>
<target name="jar-src" depends="init">
<jar destfile="${build.dir}/${final.name}-src.jar">
<fileset dir="." includes="src/"/>
</jar>
<jarify basedir="${src.dir}" destfile="${build.dir}/${final.name}-src.jar"/>
</target>
<target name="default" depends="jar-core"/>
@ -501,3 +488,4 @@

View File

@ -75,11 +75,16 @@
property="pom.xml.present">
</available>
<target name="dist-maven" if="pom.xml.present" depends="compile-core">
<artifact:pom file="${common.dir}/build/lucene-parent-pom.xml" id="maven.project"/>
<artifact:pom file="${common.dir}/build/lucene-core-pom.xml" id="maven.project"/>
<artifact:pom file="${common.dir}/build/lucene-contrib-pom.xml" id="maven.project"/>
<m2-deploy/>
<target name="dist-maven" if="pom.xml.present" depends="compile-core, jar-src">
<sequential>
<jarify basedir="${src.dir}" destfile="${build.dir}/${final.name}-sources.jar"/>
<m2-deploy>
<artifact-attachments>
<attach file="${build.dir}/${final.name}-src.jar"
classifier="sources"/>
</artifact-attachments>
</m2-deploy>
</sequential>
</target>
</project>

View File

@ -46,4 +46,13 @@
</manifest-attributes>
</jarify>
</target>
<target name="jar-src" depends="init">
<jarify basedir="${src.dir}" destfile="${build.dir}/${final.name}-src.jar">
<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>

View File

@ -30,9 +30,27 @@
<property name="snowball.root" value="snowball/website"/>
<property name="bin.dir" location="bin"/>
<patternset id="metainf.includes">
<target name="jar" depends="compile" description="Create JAR">
<jarify>
<metainf-includes>
<metainf dir=".">
<include name="SNOWBALL-LICENSE.txt"/>
</patternset>
</metainf>
</metainf-includes>
</jarify>
</target>
<target name="jar-src" depends="init"
description="Packages the sources as JAR file">
<jarify basedir="${src.dir}" destfile="${build.dir}/${final.name}-src.jar">
<metainf-includes>
<metainf dir=".">
<include name="SNOWBALL-LICENSE.txt"/>
</metainf>
</metainf-includes>
</jarify>
</target>
<!-- ====================================================== -->
<!-- Download Snowball code -->

View File

@ -20,7 +20,11 @@
specific language governing permissions and limitations
under the License.
-->
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
<version>4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-parent</artifactId>

View File

@ -31,6 +31,8 @@
<property name="demo.name" value="lucene-demos-${version}"/>
<property name="demo.war.name" value="luceneweb"/>
<property name="manifest.file" location="${build.dir}/MANIFEST.MF"/>
<!-- Build classpath -->
<path id="classpath">
<pathelement location="${common.dir}/${core.name}.jar"/>
@ -63,63 +65,37 @@
<target name="jar-demo" depends="compile-demo"
description="Build demo jar file">
<sequential>
<build-manifest/>
<jar
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>
excludes="**/*.java"
manifest="${manifest.file}">
<metainf dir="${common.dir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
</jar>
</sequential>
</target>
<target name="war-demo" depends="jar-demo"
description="Build demo war file">
<sequential>
<build-manifest/>
<war destfile="${demo.war.name}.war"
webxml="src/jsp/WEB-INF/web.xml">
webxml="src/jsp/WEB-INF/web.xml"
manifest="${manifest.file}">
<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"/>
</metainf>
</war>
</sequential>
</target>
<!-- ================================================================== -->
@ -210,6 +186,29 @@
<!--+
| M A C R O S
+-->
<macrodef name="build-manifest" description="Builds a manifest file">
<sequential>
<manifest file="${manifest.file}">
<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>
</sequential>
</macrodef>
<macrodef name="compile">
<attribute name="srcdir"/>
<attribute name="destdir"/>