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
|
---|
32 | replacing 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
|
---|
38 | file specification.</a>. Specifically, a manifest element consists of
|
---|
39 | a set of attributes and sections. These sections in turn may contain
|
---|
40 | attributes. Note in particular that this may result in manifest lines
|
---|
41 | greater than 72 bytes being wrapped and continued on the next
|
---|
42 | line.</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 <zip>
|
---|
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
|
---|
88 | not 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
|
---|
110 | href="#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 | <manifest file="MANIFEST.MF">
|
---|
130 | <attribute name="Built-By" value="${user.name}"/>
|
---|
131 | <section name="common">
|
---|
132 | <attribute name="Specification-Title" value="Example"/>
|
---|
133 | <attribute name="Specification-Version" value="${version}"/>
|
---|
134 | <attribute name="Specification-Vendor" value="Example Organization"/>
|
---|
135 | <attribute name="Implementation-Title" value="common"/>
|
---|
136 | <attribute name="Implementation-Version" value="${version} ${TODAY}"/>
|
---|
137 | <attribute name="Implementation-Vendor" value="Example Corp."/>
|
---|
138 | </section>
|
---|
139 | <section name="common/class1.class">
|
---|
140 | <attribute name="Sealed" value="false"/>
|
---|
141 | </section>
|
---|
142 | </manifest>
|
---|
143 | </pre>
|
---|
144 |
|
---|
145 | <p>Creates or replaces the file MANIFEST.MF. Note that the Built-By
|
---|
146 | attribute will take the value of the Ant property ${user.name}. The
|
---|
147 | same is true for the ${version} and ${TODAY} properties. This example
|
---|
148 | produces a MANIFEST.MF that contains
|
---|
149 | <a href="http://java.sun.com/j2se/1.5.0/docs/guide/versioning/">package
|
---|
150 | version 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
|
---|
155 | Built-By: bodewig
|
---|
156 | Created-By: Apache Ant 1.7
|
---|
157 |
|
---|
158 | Name: common
|
---|
159 | Specification-Title: Example
|
---|
160 | Specification-Vendor: Example Organization
|
---|
161 | Implementation-Vendor: Example Corp.
|
---|
162 | Specification-Version: 1.2
|
---|
163 | Implementation-Version: 1.2 February 19 2006
|
---|
164 | Implementation-Title: common
|
---|
165 |
|
---|
166 | Name: common/class1.class
|
---|
167 | Sealed: false
|
---|
168 |
|
---|
169 | </code></pre>
|
---|
170 |
|
---|
171 |
|
---|
172 | </body>
|
---|
173 | </html>
|
---|
174 |
|
---|