2006-09-11 04:19:00 +00:00
|
|
|
<!--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
2001-12-12 10:54:08 +00:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
2001-12-12 10:54:08 +00:00
|
|
|
<title>Manifest Task</title>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h2 id="manifest">Manifest</h2>
|
2001-12-12 10:54:08 +00:00
|
|
|
<h3>Description</h3>
|
|
|
|
<p>Creates a manifest file.</p>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>This task can be used to write a Manifest file, optionally replacing or updating an existing
|
|
|
|
file.</p>
|
|
|
|
|
|
|
|
<p>Manifests are processed according to
|
2018-03-08 07:43:53 +01:00
|
|
|
the <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/jar/jar.html" target="_top">Jar
|
|
|
|
file specification</a>. Specifically, a manifest element consists of a set of attributes and
|
2018-02-28 07:58:59 +01:00
|
|
|
sections. These sections in turn may contain attributes. Note in particular that this may result in
|
|
|
|
manifest lines greater than 72 bytes being wrapped and continued on the next line.</p>
|
|
|
|
|
|
|
|
<p>The Apache Ant team regularly gets complaints that this task in generating invalid manifests. By
|
|
|
|
and large, this is not the case: we believe that we are following the specification to the
|
|
|
|
letter. The usual problem is that some third party manifest reader is not following the same
|
|
|
|
specification as well as they think they should; we cannot generate invalid manifest files just
|
|
|
|
because one single application is broken. Java ME runtimes appear to be particularly
|
|
|
|
troublesome.</p>
|
|
|
|
|
|
|
|
<p>If you find that Ant generates manifests incompatible with your runtime, take a manifest it has
|
|
|
|
built, fix it up however you need and switch to using the <a href="zip.html">zip</a> task to create
|
|
|
|
the JAR, feeding in the hand-crafted manifest.</p>
|
2004-11-11 17:48:36 +00:00
|
|
|
|
2001-12-12 10:54:08 +00:00
|
|
|
<h3>Parameters</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2001-12-12 10:54:08 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>Attribute</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Required</th>
|
2001-12-12 10:54:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>file</td>
|
|
|
|
<td>the manifest-file to create/update.</td>
|
|
|
|
<td>Yes</td>
|
2001-12-12 10:54:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>mode</td>
|
|
|
|
<td>One of <q>update</q> or <q>replace</q>.</td>
|
|
|
|
<td>No; default is <q>replace</q></td>
|
2001-12-12 10:54:08 +00:00
|
|
|
</tr>
|
2003-03-22 09:39:46 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>encoding</td>
|
|
|
|
<td>The encoding used to read the existing manifest when updating. The task will always use
|
|
|
|
UTF-8 when writing the manifest.</td>
|
|
|
|
<td>No; defaults to UTF-8 encoding</td>
|
2003-03-22 09:39:46 +00:00
|
|
|
</tr>
|
2009-08-20 13:52:09 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>mergeClassPathAttributes</td>
|
|
|
|
<td>Whether to merge the <code>Class-Path</code> attributes found in different manifests (if
|
|
|
|
updating). If <q>false</q>, only the attribute of the most recent manifest will be
|
|
|
|
preserved. <em>Since Ant 1.8.0</em>.<br/>Unless you also set <var>flattenAttributes</var>
|
|
|
|
to <q>true</q> this may result in manifests containing multiple <code>Class-Path</code>
|
|
|
|
attributes which violates the manifest specification.</td>
|
|
|
|
<td>No; default is <q>false</q></td>
|
2009-08-20 13:52:09 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>flattenAttributes</td>
|
|
|
|
<td>Whether to merge attributes occurring more than once in a section (this can only happen for
|
|
|
|
the <code>Class-Path</code> attribute) into a single attribute. <em>Since Ant
|
|
|
|
1.8.0</em>.</td>
|
|
|
|
<td>No; default is <q>false</q></td>
|
2009-08-20 13:52:09 +00:00
|
|
|
</tr>
|
2001-12-12 10:54:08 +00:00
|
|
|
</table>
|
|
|
|
|
2018-03-05 17:35:30 +01:00
|
|
|
<h3>Parameters specified as nested elements</h3>
|
2018-01-22 23:52:21 +01:00
|
|
|
<h4 id="attribute">attribute</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>One attribute for the manifest file. Those attributes that are not nested into a section will be
|
|
|
|
added to the main section.</p>
|
|
|
|
<table class="attr">
|
2001-12-12 10:54:08 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>Attribute</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Required</th>
|
2001-12-12 10:54:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>name</td>
|
|
|
|
<td>the name of the attribute, must match the regexp <q>[A-Za-z0-9][A-Za-z0-9-_]*</q>.
|
2007-04-20 06:25:05 +00:00
|
|
|
</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>Yes</td>
|
2001-12-12 10:54:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>value</td>
|
|
|
|
<td>the value of the attribute.</td>
|
|
|
|
<td>Yes</td>
|
2001-12-12 10:54:08 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<h4>section</h4>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>A manifest section—you can nest <a href="#attribute">attribute</a> elements into
|
|
|
|
sections.</p>
|
2001-12-12 10:54:08 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2001-12-12 10:54:08 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>Attribute</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Required</th>
|
2001-12-12 10:54:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>name</td>
|
|
|
|
<td>the name of the section.</td>
|
|
|
|
<td>No, defaults to the main section</td>
|
2001-12-12 10:54:08 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
2001-12-12 11:05:34 +00:00
|
|
|
|
|
|
|
<h3>Examples</h3>
|
|
|
|
|
|
|
|
<pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<manifest file="MANIFEST.MF">
|
|
|
|
<attribute name="Built-By" value="${user.name}"/>
|
|
|
|
<section name="common">
|
|
|
|
<attribute name="Specification-Title" value="Example"/>
|
|
|
|
<attribute name="Specification-Version" value="${version}"/>
|
|
|
|
<attribute name="Specification-Vendor" value="Example Organization"/>
|
|
|
|
<attribute name="Implementation-Title" value="common"/>
|
|
|
|
<attribute name="Implementation-Version" value="${version} ${TODAY}"/>
|
|
|
|
<attribute name="Implementation-Vendor" value="Example Corp."/>
|
|
|
|
</section>
|
|
|
|
<section name="common/class1.class">
|
|
|
|
<attribute name="Sealed" value="false"/>
|
|
|
|
</section>
|
|
|
|
</manifest></pre>
|
|
|
|
|
|
|
|
<p>Creates or replaces the file <samp>MANIFEST.MF</samp>. Note that the <code>Built-By</code>
|
|
|
|
attribute will take the value of the Ant property <code>${user.name}</code>. The same is true for
|
|
|
|
the <code>${version}</code> and <code>${TODAY}</code> properties. This example produces
|
|
|
|
a <samp>MANIFEST.MF</samp> that
|
2018-03-08 07:43:53 +01:00
|
|
|
contains <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/versioning/spec/versioning2.html#wp90779"
|
|
|
|
target="_top">package version identification</a> for the package <samp>common</samp>.</p>
|
2002-02-19 15:22:55 +00:00
|
|
|
|
|
|
|
<p>The manifest produced by the above would look like this:</p>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre>
|
|
|
|
Manifest-Version: 1.0
|
2001-12-12 11:05:34 +00:00
|
|
|
Built-By: bodewig
|
2013-09-13 13:40:23 +00:00
|
|
|
Created-By: Apache Ant 1.9
|
2001-12-12 11:05:34 +00:00
|
|
|
|
2002-02-19 15:22:55 +00:00
|
|
|
Name: common
|
|
|
|
Specification-Title: Example
|
|
|
|
Specification-Vendor: Example Organization
|
|
|
|
Implementation-Vendor: Example Corp.
|
2006-07-06 09:00:14 +00:00
|
|
|
Specification-Version: 1.2
|
2013-09-13 13:40:23 +00:00
|
|
|
Implementation-Version: 1.2 September 10, 2013
|
2002-02-19 15:22:55 +00:00
|
|
|
Implementation-Title: common
|
|
|
|
|
2001-12-12 11:05:34 +00:00
|
|
|
Name: common/class1.class
|
2018-02-28 07:58:59 +01:00
|
|
|
Sealed: false</pre>
|
2002-02-19 15:22:55 +00:00
|
|
|
|
2001-12-12 10:54:08 +00:00
|
|
|
</body>
|
|
|
|
</html>
|