source: release-kits/lirk3/bin/ant-installer/web/manual1.7.0/manual/CoreTasks/manifest.html@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 6.0 KB
Line 
1<!--
2 Licensed to the Apache Software Foundation (ASF) under one or more
3 contributor license agreements. See the NOTICE file distributed with
4 this work for additional information regarding copyright ownership.
5 The ASF licenses this file to You under the Apache License, Version 2.0
6 (the "License"); you may not use this file except in compliance with
7 the License. You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16-->
17<html>
18
19<head>
20<meta http-equiv="Content-Language" content="en-us">
21<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
22<title>Manifest Task</title>
23</head>
24
25<body>
26
27<h2><a name="manifest">Manifest</a></h2>
28<h3>Description</h3>
29<p>Creates a manifest file.</p>
30
31<p>This task can be used to write a Manifest file, optionally
32replacing or updating an existing file.</p>
33
34
35
36<p>Manifests are processed according to the
37<a href="http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html">Jar
38file specification.</a>. Specifically, a manifest element consists of
39a set of attributes and sections. These sections in turn may contain
40attributes. Note in particular that this may result in manifest lines
41greater than 72 bytes being wrapped and continued on the next
42line.</p>
43
44<p>
45 The Ant team regularly gets complaints that this task in generating invalid
46 manifests. By and large, this is not the case: we believe that we are following
47 the specification to the letter. The usual problem is that some third party
48 manifest reader is not following the same specification as well as they think
49 they should; we cannot generate invalid manifest files just because one
50 single application is broken. J2ME runtimes appear to be particularly troublesome.
51</p>
52
53<p>
54 If you find that Ant generates manifests incompatible with your runtime, take
55 a manifest it has built, fix it up however you need and switch to using the &lt;zip&gt
56 task to create the JAR, feeding in the hand-crafted manifest.
57</p>
58
59
60
61<h3>Parameters</h3>
62<table border="1" cellpadding="2" cellspacing="0">
63 <tr>
64 <td valign="top"><b>Attribute</b></td>
65 <td valign="top"><b>Description</b></td>
66 <td align="center" valign="top"><b>Required</b></td>
67 </tr>
68 <tr>
69 <td valign="top">file</td>
70 <td valign="top">the manifest-file to create/update.</td>
71 <td valign="top" align="center">Yes</td>
72 </tr>
73 <tr>
74 <td valign="top">mode</td>
75 <td valign="top">One of "update" or "replace", default is "replace".</td>
76 <td valign="top" align="center">No</td>
77 </tr>
78 <tr>
79 <td valign="top">encoding</td>
80 <td valign="top">The encoding used to read the existing manifest when updating.</td>
81 <td valign="top" align="center">No, defaults to UTF-8 encoding.</td>
82 </tr>
83</table>
84
85<h3>Nested elements</h3>
86<h4><a name="attribute">attribute</a></h4>
87<p>One attribute for the manifest file. Those attributes that are
88not nested into a section will be added to the "Main" section.</p>
89<table border="1" cellpadding="2" cellspacing="0">
90 <tr>
91 <td valign="top"><b>Attribute</b></td>
92 <td valign="top"><b>Description</b></td>
93 <td align="center" valign="top"><b>Required</b></td>
94 </tr>
95 <tr>
96 <td valign="top">name</td>
97 <td valign="top">the name of the attribute.</td>
98 <td valign="top" align="center">Yes</td>
99 </tr>
100 <tr>
101 <td valign="top">value</td>
102 <td valign="top">the value of the attribute.</td>
103 <td valign="top" align="center">Yes</td>
104 </tr>
105</table>
106
107
108<h4>section</h4>
109<p>A manifest section - you can nest <a
110href="#attribute">attribute</a> elements into sections.</p>
111
112<table border="1" cellpadding="2" cellspacing="0">
113 <tr>
114 <td valign="top"><b>Attribute</b></td>
115 <td valign="top"><b>Description</b></td>
116 <td align="center" valign="top"><b>Required</b></td>
117 </tr>
118 <tr>
119 <td valign="top">name</td>
120 <td valign="top">the name of the section.</td>
121 <td valign="top" align="center">No, if omitted it will be assumed
122 to be the main section.</td>
123 </tr>
124</table>
125
126<h3>Examples</h3>
127
128<pre>
129 &lt;manifest file=&quot;MANIFEST.MF&quot;&gt;
130 &lt;attribute name=&quot;Built-By&quot; value=&quot;${user.name}&quot;/&gt;
131 &lt;section name=&quot;common&quot;&gt;
132 &lt;attribute name=&quot;Specification-Title&quot; value=&quot;Example&quot;/&gt;
133 &lt;attribute name=&quot;Specification-Version&quot; value=&quot;${version}&quot;/&gt;
134 &lt;attribute name=&quot;Specification-Vendor&quot; value=&quot;Example Organization&quot;/&gt;
135 &lt;attribute name=&quot;Implementation-Title&quot; value=&quot;common&quot;/&gt;
136 &lt;attribute name=&quot;Implementation-Version&quot; value=&quot;${version} ${TODAY}&quot;/&gt;
137 &lt;attribute name=&quot;Implementation-Vendor&quot; value=&quot;Example Corp.&quot;/&gt;
138 &lt;/section&gt;
139 &lt;section name=&quot;common/class1.class&quot;&gt;
140 &lt;attribute name=&quot;Sealed&quot; value=&quot;false&quot;/&gt;
141 &lt;/section&gt;
142 &lt;/manifest&gt;
143</pre>
144
145<p>Creates or replaces the file MANIFEST.MF. Note that the Built-By
146attribute will take the value of the Ant property ${user.name}. The
147same is true for the ${version} and ${TODAY} properties. This example
148produces a MANIFEST.MF that contains
149<a href="http://java.sun.com/j2se/1.5.0/docs/guide/versioning/">package
150version identification</a> for the package <code>common</code>.</p>
151
152<p>The manifest produced by the above would look like this:</p>
153
154<pre><code>Manifest-Version: 1.0
155Built-By: bodewig
156Created-By: Apache Ant 1.7
157
158Name: common
159Specification-Title: Example
160Specification-Vendor: Example Organization
161Implementation-Vendor: Example Corp.
162Specification-Version: 1.2
163Implementation-Version: 1.2 February 19 2006
164Implementation-Title: common
165
166Name: common/class1.class
167Sealed: false
168
169</code></pre>
170
171
172</body>
173</html>
174
Note: See TracBrowser for help on using the repository browser.