You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

manifest.html 5.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  5. <title>Manifest Task</title>
  6. </head>
  7. <body>
  8. <h2><a name="manifest">Manifest</a></h2>
  9. <h3>Description</h3>
  10. <p>Creates a manifest file.</p>
  11. <p>This task can be used to write a Manifest file, optionally
  12. replacing or updating an existing file.</p>
  13. <p>Manifests are processed according to the
  14. <a href="http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html">Jar
  15. file specification.</a>. Specifically, a manifest element consists of
  16. a set of attributes and sections. These sections in turn may contain
  17. attributes. Note in particular that this may result in manifest lines
  18. greater than 72 bytes being wrapped and continued on the next
  19. line.</p>
  20. <p>
  21. The Ant team regularly gets complaints that this task in generating invalid
  22. manifests. By and large, this is not the case: we believe that we are following
  23. the specification to the letter. The usual problem is that some third party
  24. manifest reader is not following the same specification as well as they think
  25. they should; we cannot generate invalid manifest files just because one
  26. single application is broken. J2ME runtimes appear to be particularly troublesome.
  27. </p>
  28. <p>
  29. If you find that Ant generates manifests incompatible with your runtime, take
  30. a manifest it has built, fix it up however you need and switch to using the &lt;zip&gt
  31. task to create the JAR, feeding in the hand-crafted manifest.
  32. </p>
  33. <h3>Parameters</h3>
  34. <table border="1" cellpadding="2" cellspacing="0">
  35. <tr>
  36. <td valign="top"><b>Attribute</b></td>
  37. <td valign="top"><b>Description</b></td>
  38. <td align="center" valign="top"><b>Required</b></td>
  39. </tr>
  40. <tr>
  41. <td valign="top">file</td>
  42. <td valign="top">the manifest-file to create/update.</td>
  43. <td valign="top" align="center">Yes</td>
  44. </tr>
  45. <tr>
  46. <td valign="top">mode</td>
  47. <td valign="top">One of "update" or "replace", default is "replace".</td>
  48. <td valign="top" align="center">No</td>
  49. </tr>
  50. <tr>
  51. <td valign="top">encoding</td>
  52. <td valign="top">The encoding used to read the existing manifest when updating.</td>
  53. <td valign="top" align="center">No, defaults to UTF-8 encoding.</td>
  54. </tr>
  55. </table>
  56. <h3>Nested elements</h3>
  57. <h4><a name="attribute">attribute</a></h4>
  58. <p>One attribute for the manifest file. Those attributes that are
  59. not nested into a section will be added to the "Main" section.</p>
  60. <table border="1" cellpadding="2" cellspacing="0">
  61. <tr>
  62. <td valign="top"><b>Attribute</b></td>
  63. <td valign="top"><b>Description</b></td>
  64. <td align="center" valign="top"><b>Required</b></td>
  65. </tr>
  66. <tr>
  67. <td valign="top">name</td>
  68. <td valign="top">the name of the attribute.</td>
  69. <td valign="top" align="center">Yes</td>
  70. </tr>
  71. <tr>
  72. <td valign="top">value</td>
  73. <td valign="top">the value of the attribute.</td>
  74. <td valign="top" align="center">Yes</td>
  75. </tr>
  76. </table>
  77. <h4>section</h4>
  78. <p>A manifest section - you can nest <a
  79. href="#attribute">attribute</a> elements into sections.</p>
  80. <table border="1" cellpadding="2" cellspacing="0">
  81. <tr>
  82. <td valign="top"><b>Attribute</b></td>
  83. <td valign="top"><b>Description</b></td>
  84. <td align="center" valign="top"><b>Required</b></td>
  85. </tr>
  86. <tr>
  87. <td valign="top">name</td>
  88. <td valign="top">the name of the section.</td>
  89. <td valign="top" align="center">No, if omitted it will be assumed
  90. to be the main section.</td>
  91. </tr>
  92. </table>
  93. <h3>Examples</h3>
  94. <pre>
  95. &lt;manifest file=&quot;MANIFEST.MF&quot;&gt;
  96. &lt;attribute name=&quot;Built-By&quot; value=&quot;${user.name}&quot;/&gt;
  97. &lt;section name=&quot;common&quot;&gt;
  98. &lt;attribute name=&quot;Specification-Title&quot; value=&quot;Example&quot;/&gt;
  99. &lt;attribute name=&quot;Specification-Version&quot; value=&quot;${version}&quot;/&gt;
  100. &lt;attribute name=&quot;Specification-Vendor&quot; value=&quot;Example Organization&quot;/&gt;
  101. &lt;attribute name=&quot;Implementation-Title&quot; value=&quot;common&quot;/&gt;
  102. &lt;attribute name=&quot;Implementation-Version&quot; value=&quot;${version} ${TODAY}&quot;/&gt;
  103. &lt;attribute name=&quot;Implementation-Vendor&quot; value=&quot;Example Corp.&quot;/&gt;
  104. &lt;/section&gt;
  105. &lt;section name=&quot;common/class1.class&quot;&gt;
  106. &lt;attribute name=&quot;Sealed&quot; value=&quot;false&quot;/&gt;
  107. &lt;/section&gt;
  108. &lt;/manifest&gt;
  109. </pre>
  110. <p>Creates or replaces the file MANIFEST.MF. Note that the Built-By
  111. attribute will take the value of the Ant property ${user.name}. The
  112. same is true for the ${version} and ${TODAY} properties. This example
  113. produces a MANIFEST.MF that contains
  114. <a href="http://java.sun.com/j2se/1.5.0/docs/guide/versioning/">package
  115. version identification</a> for the package <code>common</code>.</p>
  116. <p>The manifest produced by the above would look like this:</p>
  117. <pre><code>Manifest-Version: 1.0
  118. Built-By: bodewig
  119. Created-By: Apache Ant 1.7
  120. Name: common
  121. Specification-Title: Example
  122. Specification-Vendor: Example Organization
  123. Implementation-Vendor: Example Corp.
  124. Specification-Version: 1.2
  125. Implementation-Version: 1.2 February 19 2006
  126. Implementation-Title: common
  127. Name: common/class1.class
  128. Sealed: false
  129. </code></pre>
  130. <hr>
  131. <p align="center">Copyright &copy; 2001-2006 The Apache Software Foundation. All rights
  132. Reserved.</p>
  133. </body>
  134. </html>