Index: build.xml
===================================================================
--- build.xml	(revision 567313)
+++ build.xml	(working copy)
@@ -106,62 +106,36 @@
   <!-- ================================================================== -->
 
   <target name="jar-demo" depends="compile-demo">
-    <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>    	
-      <metainf dir="${common.dir}">
-        <include name="LICENSE.txt"/>
-        <include name="NOTICE.txt"/>
-      </metainf>
-    </jar>
+  	<sequential>
+  	  <build-manifest title="Lucene Search Engine: demos"/>
+      <jar
+        destfile="${build.dir}/${demo.name}.jar"
+        basedir="${build.dir}/classes/demo"
+        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-core,jar-demo">
-    <war destfile="${build.dir}/${demo.war.name}.war"
-         webxml="src/jsp/WEB-INF/web.xml">
-      <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>
+      <build-manifest title="Lucene Search Engine: demos"/>
+  	  <war destfile="${build.dir}/${demo.war.name}.war"
+           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"/>
+        <metainf dir="${common.dir}">
+          <include name="LICENSE.txt"/>
+          <include name="NOTICE.txt"/>
+        </metainf>
+      </war>
+    </sequential>
   </target>
 
 
Index: common-build.xml
===================================================================
--- common-build.xml	(revision 567313)
+++ common-build.xml	(working copy)
@@ -64,14 +64,8 @@
   <property name="junit.reports" location="${build.dir}/test/reports"/>
   <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">
@@ -250,66 +244,55 @@
       </artifact:install>
     </sequential>
   </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">
     <attribute name="title" default="Lucene Search Engine: ${ant.project.name}" />
-    <element name="manifest-attributes" optional="yes"/>
+    <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>
-     
+      
       <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="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>
+        basedir="${build.dir}/classes/java"
+      	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>
Index: contrib/snowball/build.xml
===================================================================
--- contrib/snowball/build.xml	(revision 567313)
+++ contrib/snowball/build.xml	(working copy)
@@ -30,10 +30,16 @@
   <property name="snowball.root" value="snowball/website"/>
   <property name="bin.dir" location="bin"/>
 
-  <patternset id="metainf.includes">
-    <include name="SNOWBALL-LICENSE.txt"/>
-  </patternset>
-
+  <target name="jar" depends="compile" description="Create JAR">
+    <jarify>
+      <metainf-includes>
+        <metainf dir=".">
+          <include name="SNOWBALL-LICENSE.txt"/>
+        </metainf>
+      </metainf-includes>
+    </jarify>
+  </target>
+	
   <!-- ====================================================== -->
   <!-- Download Snowball code                                 -->
   <!-- ====================================================== -->
Index: src/demo/demo-build.template
===================================================================
--- src/demo/demo-build.template	(revision 567313)
+++ src/demo/demo-build.template	(working copy)
@@ -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">
-    <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>    	
-      <metainf dir="${common.dir}">
-        <include name="LICENSE.txt"/>
-        <include name="NOTICE.txt"/>
-      </metainf>
-    </jar>
+	<sequential>
+  	  <build-manifest/>
+	  <jar
+        destfile="${demo.name}.jar"
+        basedir="${build.dir}/classes/demo"
+        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">
-    <war destfile="${demo.war.name}.war"
-         webxml="src/jsp/WEB-INF/web.xml">
-      <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>
+  	  <build-manifest/>
+      <war destfile="${demo.war.name}.war"
+           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"/>
+        <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"/>
