conor 01/12/12 02:31:25 Modified: docs/manual/CoreTasks jar.html Log: Documentation of inline manifests (at last) Revision Changes Path 1.11 +97 -0 jakarta-ant/docs/manual/CoreTasks/jar.html Index: jar.html =================================================================== RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/jar.html,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -u -r1.10 -r1.11 --- jar.html 2001/11/08 16:16:08 1.10 +++ jar.html 2001/12/12 10:31:25 1.11 @@ -44,6 +44,12 @@ <i>manifest</i> attribute is not specified, the Jar task will include an empty one for you.)</p> +<p>Manifests are processed by the Jar task according to the +<a href="http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html">Jar file specification.</a> +Note in particular that this may result in manifest lines greater than 72 bytes +being wrapped and continued on the next line. +</p> + <h3>Parameters</h3> <table border="1" cellpadding="2" cellspacing="0"> <tr> @@ -121,6 +127,7 @@ <td valign="top" align="center">No</td> </tr> </table> + <h3>Nested elements</h3> <h4>metainf</h4> <p>The nested <code>metainf</code> element specifies a <a @@ -128,6 +135,75 @@ end up in the <code>META-INF</code> directory of the jar file. If this fileset includes a file named <code>MANIFEST.MF</code>, the file is ignored and you will get a warning.</p> + +<h4>Manifest</h4> +<p> +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. +</p> +<p> +The manifest element supports nested elements to reflect the structure of +manifests, according to the +<a href="http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html">Jar file +specification</a>. Specifically, a manifest +element consists of a set of attributes and sections. These sections in turn +may contain attributes. +</p> + +<p>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. +</p> + +<p> 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: +</p> +<p> +<b>Section</b> +</p> +<p> +<table border="1" cellpadding="2" cellspacing="0"> + <tr> + <td valign="top"><b>Attribute</b></td> + <td valign="top"><b>Description</b></td> + <td align="center" valign="top"><b>Required</b></td> + </tr> + <tr> + <td valign="top">Name</td> + <td valign="top">The name of the section</td> + <td valign="top" align="center">Yes</td> + </tr> +</table> +</p> + +<p> +<b>Attribute</b> +</p> +<p> +<table border="1" cellpadding="2" cellspacing="0"> + <tr> + <td valign="top"><b>Attribute</b></td> + <td valign="top"><b>Description</b></td> + <td align="center" valign="top"><b>Required</b></td> + </tr> + <tr> + <td valign="top">Name</td> + <td valign="top">The name of the attribute</td> + <td valign="top" align="center">Yes</td> + </tr> + <tr> + <td valign="top">Value</td> + <td valign="top">The value of the attribute</td> + <td valign="top" align="center">Yes</td> + </tr> +</table> +</p> + <h3>Examples</h3> <pre> <jar file="${dist}/lib/app.jar" basedir="${build}/classes"/></pre> <p>jars all files in the <code>${build}/classes</code> directory into a file @@ -162,6 +238,27 @@ and <code>${src}/resources/mypackage/image.gif</code>, they will appear in the same directory in the JAR (and thus be considered in the same package by Java).</p> + +<pre> <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></pre> +<p> +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: +</p> +<pre><code>Manifest-Version: 1.0 +Built-By: conor +Created-By: Apache Ant 1.5alpha + +Name: common/class1.class +Sealed: false</code></pre> <hr> <p align="center">Copyright © 2000,2001 Apache Software Foundation. All rights
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
