diff --git a/docs/manual/CoreTasks/jar.html b/docs/manual/CoreTasks/jar.html index 8182dd278..8a84baadc 100644 --- a/docs/manual/CoreTasks/jar.html +++ b/docs/manual/CoreTasks/jar.html @@ -44,6 +44,12 @@ attribute of a zipfileset in a Zip task. The one difference is that if the manifest attribute is not specified, the Jar task will include an empty one for you.)

+

Manifests are processed by the Jar task according to the +Jar file specification. +Note in particular that this may result in manifest lines greater than 72 bytes +being wrapped and continued on the next line. +

+

Parameters

@@ -121,6 +127,7 @@ include an empty one for you.)

No
+

Nested elements

metainf

The nested metainf element specifies a FileSet. All files included in this fileset end up in the META-INF directory of the jar file. If this fileset includes a file named MANIFEST.MF, the file is ignored and you will get a warning.

+ +

Manifest

+

+The manifest nested element allows the manifest for the Jar file to be +provided inline in the build file rather than in an external file. This +makes it easy to produce Jar manifests which take values from Ant properties. +If both an inline manifest and an external file are both specified, the +manifests are merged. +

+

+The manifest element supports nested elements to reflect the structure of +manifests, according to the +Jar file +specification. Specifically, a manifest +element consists of a set of attributes and sections. These sections in turn +may contain attributes. +

+ +

When using inline manifests, the Jar task will check whether the build +file is more recent that the Jar file when deciding whether to rebuild the +Jar. This will not take into account property file changes which may affect +the resulting Jar. +

+ +

The manifest element itself does not support any attributes. It serves +merely as a container for the attribute and section elements that make up the +manifest. The attributes of those elements are as follows: +

+

+Section +

+

+ + + + + + + + + + + +
AttributeDescriptionRequired
NameThe name of the sectionYes
+

+ +

+Attribute +

+

+ + + + + + + + + + + + + + + + +
AttributeDescriptionRequired
NameThe name of the attributeYes
ValueThe value of the attributeYes
+

+

Examples

  <jar file="${dist}/lib/app.jar" basedir="${build}/classes"/>

jars all files in the ${build}/classes directory into a file @@ -163,6 +239,27 @@ and ${src}/resources/mypackage/image.gif, they will appear in the same directory in the JAR (and thus be considered in the same package by Java).

+
  <jar jarfile="test.jar" basedir=".">
+    <include name="build"/>
+    <manifest>
+      <attribute name="Built-By" value="${user.name}"/>
+      <section name="common/class1.class">
+        <attribute name="Sealed" value="false"/>
+      </section>
+    </manifest>
+  </jar>
+

+This is an example of an inline manifest specification. Note that the Built-By +attribute will take the value of the Ant property ${user.name}. The manifest +produced by the above would look like this: +

+
Manifest-Version: 1.0
+Built-By: conor
+Created-By: Apache Ant 1.5alpha
+
+Name: common/class1.class
+Sealed: false
+

Copyright © 2000,2001 Apache Software Foundation. All rights Reserved.