- 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 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 Test Cases
======================= Release 2.2.0 2007-06-19 ======================= ======================= Release 2.2.0 2007-06-19 =======================

117
build.xml
View File

@ -106,62 +106,51 @@
<!-- ================================================================== --> <!-- ================================================================== -->
<target name="jar-demo" depends="compile-demo"> <target name="jar-demo" depends="compile-demo">
<jar <sequential>
destfile="${build.dir}/${demo.name}.jar" <build-manifest title="Lucene Search Engine: demos"/>
basedir="${build.dir}/classes/demo" <jar
excludes="**/*.java"> destfile="${build.dir}/${demo.name}.jar"
<manifest> basedir="${build.dir}/classes/demo"
<attribute name="Specification-Title" value="Lucene Search Engine: demos"/> excludes="**/*.java"
<!-- spec version must match "digit+{.digit+}*" --> manifest="${manifest.file}">
<attribute name="Specification-Version" value="${version}"/> <metainf dir="${common.dir}">
<attribute name="Specification-Vendor" <include name="LICENSE.txt"/>
value="The Apache Software Foundation"/> <include name="NOTICE.txt"/>
<attribute name="Implementation-Title" value="org.apache.lucene"/> </metainf>
<!-- impl version can be any string --> </jar>
<attribute name="Implementation-Version" </sequential>
value="${version}"/> </target>
<attribute name="Implementation-Vendor"
value="The Apache Software Foundation"/> <target name="jar-demo-src" depends="compile-demo">
<attribute name="X-Compile-Source-JDK" <sequential>
value="${javac.source}"/> <build-manifest title="Lucene Search Engine: demos"/>
<attribute name="X-Compile-Target-JDK" <jar
value="${javac.target}"/> destfile="${build.dir}/${demo.name}-src.jar"
</manifest> basedir="src/demo"
<metainf dir="${common.dir}"> manifest="${manifest.file}">
<include name="LICENSE.txt"/> <metainf dir="${common.dir}">
<include name="NOTICE.txt"/> <include name="LICENSE.txt"/>
</metainf> <include name="NOTICE.txt"/>
</jar> </metainf>
</jar>
</sequential>
</target> </target>
<target name="war-demo" depends="jar-core,jar-demo"> <target name="war-demo" depends="jar-core,jar-demo">
<war destfile="${build.dir}/${demo.war.name}.war" <sequential>
webxml="src/jsp/WEB-INF/web.xml"> <build-manifest title="Lucene Search Engine: demos"/>
<fileset dir="src/jsp" excludes="WEB-INF/web.xml"/> <war destfile="${build.dir}/${demo.war.name}.war"
<lib dir="${build.dir}" includes="${demo.name}.jar"/> webxml="src/jsp/WEB-INF/web.xml"
<lib dir="${build.dir}" includes="${final.name}.jar"/> manifest="${manifest.file}">
<manifest> <fileset dir="src/jsp" excludes="WEB-INF/web.xml"/>
<attribute name="Specification-Title" value="Lucene Search Engine: demos"/> <lib dir="${build.dir}" includes="${demo.name}.jar"/>
<!-- spec version must match "digit+{.digit+}*" --> <lib dir="${build.dir}" includes="${final.name}.jar"/>
<attribute name="Specification-Version" value="${version}"/> <metainf dir="${common.dir}">
<attribute name="Specification-Vendor" <include name="LICENSE.txt"/>
value="The Apache Software Foundation"/> <include name="NOTICE.txt"/>
<attribute name="Implementation-Title" value="org.apache.lucene"/> </metainf>
<!-- impl version can be any string --> </war>
<attribute name="Implementation-Version" </sequential>
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>
</target> </target>
@ -361,12 +350,24 @@
<target name="dist-all" depends="dist, dist-src"/> <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> <sequential>
<m2-deploy pom.xml="lucene-parent-pom.xml"/> <m2-deploy pom.xml="lucene-parent-pom.xml.template"/>
<m2-deploy pom.xml="lucene-core-pom.xml"/> <m2-deploy pom.xml="lucene-core-pom.xml.template">
<m2-deploy pom.xml="lucene-demos-pom.xml"/> <artifact-attachments>
<m2-deploy pom.xml="lucene-contrib-pom.xml"/> <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"/> <contrib-crawl target="dist-maven"/>
<!-- do md5 checksums --> <!-- do md5 checksums -->
<checksum forceOverwrite="yes" fileext=".md5"> <checksum forceOverwrite="yes" fileext=".md5">

View File

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

View File

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

View File

@ -45,5 +45,14 @@
<attribute name="Class-Path" value="lib/jline.jar lib/lucene.jar" /> <attribute name="Class-Path" value="lib/jline.jar lib/lucene.jar" />
</manifest-attributes> </manifest-attributes>
</jarify> </jarify>
</target> </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> </project>

View File

@ -30,10 +30,28 @@
<property name="snowball.root" value="snowball/website"/> <property name="snowball.root" value="snowball/website"/>
<property name="bin.dir" location="bin"/> <property name="bin.dir" location="bin"/>
<patternset id="metainf.includes"> <target name="jar" depends="compile" description="Create JAR">
<include name="SNOWBALL-LICENSE.txt"/> <jarify>
</patternset> <metainf-includes>
<metainf dir=".">
<include name="SNOWBALL-LICENSE.txt"/>
</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 --> <!-- Download Snowball code -->
<!-- ====================================================== --> <!-- ====================================================== -->

View File

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

View File

@ -31,6 +31,8 @@
<property name="demo.name" value="lucene-demos-${version}"/> <property name="demo.name" value="lucene-demos-${version}"/>
<property name="demo.war.name" value="luceneweb"/> <property name="demo.war.name" value="luceneweb"/>
<property name="manifest.file" location="${build.dir}/MANIFEST.MF"/>
<!-- Build classpath --> <!-- Build classpath -->
<path id="classpath"> <path id="classpath">
<pathelement location="${common.dir}/${core.name}.jar"/> <pathelement location="${common.dir}/${core.name}.jar"/>
@ -63,63 +65,37 @@
<target name="jar-demo" depends="compile-demo" <target name="jar-demo" depends="compile-demo"
description="Build demo jar file"> description="Build demo jar file">
<jar <sequential>
destfile="${demo.name}.jar" <build-manifest/>
basedir="${build.dir}/classes/demo" <jar
excludes="**/*.java"> destfile="${demo.name}.jar"
<manifest> basedir="${build.dir}/classes/demo"
<attribute name="Specification-Title" value="Lucene Search Engine: demos"/> excludes="**/*.java"
<!-- spec version must match "digit+{.digit+}*" --> manifest="${manifest.file}">
<attribute name="Specification-Version" value="${version}"/> <metainf dir="${common.dir}">
<attribute name="Specification-Vendor" <include name="LICENSE.txt"/>
value="The Apache Software Foundation"/> <include name="NOTICE.txt"/>
<attribute name="Implementation-Title" value="org.apache.lucene"/> </metainf>
<!-- impl version can be any string --> </jar>
<attribute name="Implementation-Version" </sequential>
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>
</jar>
</target> </target>
<target name="war-demo" depends="jar-demo" <target name="war-demo" depends="jar-demo"
description="Build demo war file"> description="Build demo war file">
<war destfile="${demo.war.name}.war" <sequential>
webxml="src/jsp/WEB-INF/web.xml"> <build-manifest/>
<fileset dir="src/jsp" excludes="WEB-INF/web.xml"/> <war destfile="${demo.war.name}.war"
<lib dir="." includes="${demo.name}.jar"/> webxml="src/jsp/WEB-INF/web.xml"
<lib dir="." includes="${core.name}.jar"/> manifest="${manifest.file}">
<manifest> <fileset dir="src/jsp" excludes="WEB-INF/web.xml"/>
<attribute name="Specification-Title" value="Lucene Search Engine: demos"/> <lib dir="." includes="${demo.name}.jar"/>
<!-- spec version must match "digit+{.digit+}*" --> <lib dir="." includes="${core.name}.jar"/>
<attribute name="Specification-Version" value="${version}"/> <metainf dir="${common.dir}">
<attribute name="Specification-Vendor" <include name="LICENSE.txt"/>
value="The Apache Software Foundation"/> <include name="NOTICE.txt"/>
<attribute name="Implementation-Title" value="org.apache.lucene"/> </metainf>
<!-- impl version can be any string --> </war>
<attribute name="Implementation-Version" </sequential>
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>
</target> </target>
<!-- ================================================================== --> <!-- ================================================================== -->
@ -210,6 +186,29 @@
<!--+ <!--+
| M A C R O S | 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"> <macrodef name="compile">
<attribute name="srcdir"/> <attribute name="srcdir"/>
<attribute name="destdir"/> <attribute name="destdir"/>