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.

ear.html 9.4 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <html>
  16. <head>
  17. <meta http-equiv="Content-Language" content="en-us">
  18. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  19. <title>EAR Task</title>
  20. </head>
  21. <body>
  22. <h2><a name="ear">Ear</a></h2>
  23. <h3>Description</h3>
  24. <p>An extension of the <a href="jar.html">Jar</a> task with special
  25. treatment for files that should end up in an Enterprise Application archive.</p>
  26. <p>(The Ear task is a shortcut for specifying the particular layout of a EAR file.
  27. The same thing can be accomplished by using the <i>prefix</i> and <i>fullpath</i>
  28. attributes of zipfilesets in a Zip or Jar task.)</p>
  29. <p>The extended zipfileset element from the zip task (with attributes <i>prefix</i>, <i>fullpath</i>, and <i>src</i>) is available in the Ear task.</p>
  30. <p><b>Please note that the zip format allows multiple files of the same
  31. fully-qualified name to exist within a single archive. This has been
  32. documented as causing various problems for unsuspecting users. If you wish
  33. to avoid this behavior you must set the <code>duplicate</code> attribute
  34. to a value other than its default, <code>&quot;add&quot;</code>.</b></p>
  35. <h3>Parameters</h3>
  36. <table border="1" cellpadding="2" cellspacing="0">
  37. <tr>
  38. <td valign="top"><b>Attribute</b></td>
  39. <td valign="top"><b>Description</b></td>
  40. <td align="center" valign="top"><b>Required</b></td>
  41. </tr>
  42. <tr>
  43. <td valign="top">destfile</td>
  44. <td valign="top">the EAR file to create.</td>
  45. <td valign="top" align="center">Yes</td>
  46. </tr>
  47. <tr>
  48. <td valign="top">appxml</td>
  49. <td valign="top">The deployment descriptor to use (META-INF/application.xml).</td>
  50. <td valign="top" align="center">Yes, unless update is set to true</td>
  51. </tr>
  52. <tr>
  53. <td valign="top">basedir</td>
  54. <td valign="top">the directory from which to jar the files.</td>
  55. <td valign="top" align="center">No</td>
  56. </tr>
  57. <tr>
  58. <td valign="top">compress</td>
  59. <td valign="top">Not only store data but also compress them,
  60. defaults to true. Unless you set the <em>keepcompression</em>
  61. attribute to false, this will apply to the entire archive, not
  62. only the files you've added while updating.</td>
  63. <td align="center" valign="top">No</td>
  64. </tr>
  65. <tr>
  66. <td valign="top">keepcompression</td>
  67. <td valign="top">For entries coming from existing archives (like
  68. nested <em>zipfileset</em>s or while updating the archive), keep
  69. the compression as it has been originally instead of using the
  70. <em>compress</em> attribute. Defaults false. <em>Since Ant
  71. 1.6</em></td>
  72. <td align="center" valign="top">No</td>
  73. </tr>
  74. <tr>
  75. <td valign="top">encoding</td>
  76. <td valign="top">The character encoding to use for filenames
  77. inside the archive. Defaults to UTF8. <strong>It is not
  78. recommended to change this value as the created archive will most
  79. likely be unreadable for Java otherwise.</strong></td>
  80. <td align="center" valign="top">No</td>
  81. </tr>
  82. <tr>
  83. <td valign="top">filesonly</td>
  84. <td valign="top">Store only file entries, defaults to false</td>
  85. <td align="center" valign="top">No</td>
  86. </tr>
  87. <tr>
  88. <td valign="top">includes</td>
  89. <td valign="top">comma- or space-separated list of patterns of files that must be
  90. included. All files are included when omitted.</td>
  91. <td valign="top" align="center">No</td>
  92. </tr>
  93. <tr>
  94. <td valign="top">includesfile</td>
  95. <td valign="top">the name of a file. Each line of this file is
  96. taken to be an include pattern</td>
  97. <td valign="top" align="center">No</td>
  98. </tr>
  99. <tr>
  100. <td valign="top">excludes</td>
  101. <td valign="top">comma- or space-separated list of patterns of files that must be
  102. excluded. No files (except default excludes) are excluded when omitted.</td>
  103. <td valign="top" align="center">No</td>
  104. </tr>
  105. <tr>
  106. <td valign="top">excludesfile</td>
  107. <td valign="top">the name of a file. Each line of this file is
  108. taken to be an exclude pattern</td>
  109. <td valign="top" align="center">No</td>
  110. </tr>
  111. <tr>
  112. <td valign="top">defaultexcludes</td>
  113. <td valign="top">indicates whether default excludes should be used or not
  114. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  115. <td valign="top" align="center">No</td>
  116. </tr>
  117. <tr>
  118. <td valign="top">manifest</td>
  119. <td valign="top">the manifest file to use.</td>
  120. <td valign="top" align="center">No</td>
  121. </tr>
  122. <tr>
  123. <td valign="top">filesetmanifest</td>
  124. <td valign="top">behavior when a Manifest is found in a zipfileset or zipgroupfileset file is found. Valid values are &quot;skip&quot;, &quot;merge&quot;, and &quot;mergewithoutmain&quot;. &quot;merge&quot; will merge all of the manifests together, and merge this into any other specified manifests. &quot;mergewithoutmain&quot; merges everything but the Main section of the manifests. Default value is &quot;skip&quot;.
  125. </td>
  126. <td valign="top" align="center">No</td>
  127. </tr>
  128. <tr>
  129. <td valign="top">whenmanifestonly</td>
  130. <td valign="top">behavior when no files match. Valid values are &quot;fail&quot;, &quot;skip&quot;, and &quot;create&quot;. Default is &quot;create&quot;.</td>
  131. <td valign="top" align="center">No</td>
  132. </tr>
  133. <tr>
  134. <td valign="top">manifestencoding</td>
  135. <td valign="top">The encoding used to read the JAR manifest, when a manifest file is specified.</td>
  136. <td valign="top" align="center">No, defaults to the platform encoding.</td>
  137. </tr>
  138. <tr>
  139. <td valign="top">index</td>
  140. <td valign="top">whether to create an <A
  141. HREF="http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#JAR%20Index">index
  142. list</A> to speed up classloading. This is a JDK 1.3+ specific
  143. feature. Unless you specify additional jars with nested <a
  144. href="#indexjars"><code>indexjars</code></a> elements, only the
  145. contents of this jar will be included in the index. Defaults to
  146. false.</td>
  147. <td valign="top" align="center">No</td>
  148. </tr>
  149. <tr>
  150. <td valign="top">index</td>
  151. <td valign="top">whether to create an <A
  152. HREF="http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#JAR%20Index">index
  153. list</A> to speed up classloading. This is a JDK 1.3+ specific
  154. feature. Unless you specify additional jars with nested <a
  155. href="#indexjars"><code>indexjars</code></a> elements, only the
  156. contents of this jar will be included in the index. Defaults to
  157. false.</td>
  158. <td valign="top" align="center">No</td>
  159. </tr>
  160. <tr>
  161. <td valign="top">update</td>
  162. <td valign="top">indicates whether to update or overwrite
  163. the destination file if it already exists. Default is &quot;false&quot;.</td>
  164. <td valign="top" align="center">No</td>
  165. </tr>
  166. <tr>
  167. <td valign="top">duplicate</td>
  168. <td valign="top">behavior when a duplicate file is found. Valid values are &quot;add&quot;, &quot;preserve&quot;, and &quot;fail&quot;. The default value is &quot;add&quot;. </td>
  169. <td valign="top" align="center">No</td>
  170. </tr>
  171. <tr>
  172. <td valign="top">roundup</td>
  173. <td valign="top">Whether the file modification times will be
  174. rounded up to the next even number of seconds.<br>
  175. Zip archives store file modification times with a granularity of
  176. two seconds, so the times will either be rounded up or down. If
  177. you round down, the archive will always seem out-of-date when you
  178. rerun the task, so the default is to round up. Rounding up may
  179. lead to a different type of problems like JSPs inside a web
  180. archive that seem to be slightly more recent than precompiled
  181. pages, rendering precompilation useless.<br>
  182. Defaults to true. <em>Since Ant 1.6.2</em></td>
  183. <td align="center" valign="top">No</td>
  184. </tr>
  185. <tr>
  186. <td valign="top">level</td>
  187. <td valign="top">Non-default level at which file compression should be
  188. performed. Valid values range from 0 (no compression/fastest) to 9
  189. (maximum compression/slowest). <em>Since Ant 1.7</em></td>
  190. <td valign="top" align="center">No</td>
  191. </tr>
  192. </table>
  193. <h3>Nested elements</h3>
  194. <h4>metainf</h4>
  195. <p>The nested <code>metainf</code> element specifies a <a
  196. href="../CoreTypes/fileset.html">FileSet</a>. All files included in this fileset will
  197. end up in the <code>META-INF</code> directory of the ear file. If this
  198. fileset includes a file named <code>MANIFEST.MF</code>, the file is
  199. ignored and you will get a warning.</p>
  200. <h4>manifest, indexjars, service</h4>
  201. These are inherited from <a href="jar.html">&lt;jar&gt;</a>
  202. <h2>Example</h2>
  203. <pre>
  204. &lt;ear destfile=&quot;${build.dir}/myapp.ear&quot; appxml=&quot;${src.dir}/metadata/application.xml&quot;&gt;
  205. &lt;fileset dir=&quot;${build.dir}&quot; includes=&quot;*.jar,*.war&quot;/&gt;
  206. &lt;/ear&gt;
  207. </pre>
  208. </body>
  209. </html>