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 12 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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>
  80. <br/>See also the <a href="zip.html#encoding">discussion in the
  81. zip task page</a></td>
  82. <td align="center" valign="top">No</td>
  83. </tr>
  84. <tr>
  85. <td valign="top">filesonly</td>
  86. <td valign="top">Store only file entries, defaults to false</td>
  87. <td align="center" valign="top">No</td>
  88. </tr>
  89. <tr>
  90. <td valign="top">includes</td>
  91. <td valign="top">comma- or space-separated list of patterns of files that must be
  92. included. All files are included when omitted.</td>
  93. <td valign="top" align="center">No</td>
  94. </tr>
  95. <tr>
  96. <td valign="top">includesfile</td>
  97. <td valign="top">the name of a file. Each line of this file is
  98. taken to be an include pattern</td>
  99. <td valign="top" align="center">No</td>
  100. </tr>
  101. <tr>
  102. <td valign="top">excludes</td>
  103. <td valign="top">comma- or space-separated list of patterns of files that must be
  104. excluded. No files (except default excludes) are excluded when omitted.</td>
  105. <td valign="top" align="center">No</td>
  106. </tr>
  107. <tr>
  108. <td valign="top">excludesfile</td>
  109. <td valign="top">the name of a file. Each line of this file is
  110. taken to be an exclude pattern</td>
  111. <td valign="top" align="center">No</td>
  112. </tr>
  113. <tr>
  114. <td valign="top">defaultexcludes</td>
  115. <td valign="top">indicates whether default excludes should be used or not
  116. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  117. <td valign="top" align="center">No</td>
  118. </tr>
  119. <tr>
  120. <td valign="top">manifest</td>
  121. <td valign="top">the manifest file to use.</td>
  122. <td valign="top" align="center">No</td>
  123. </tr>
  124. <tr>
  125. <td valign="top">filesetmanifest</td>
  126. <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;.
  127. </td>
  128. <td valign="top" align="center">No</td>
  129. </tr>
  130. <tr>
  131. <td valign="top">whenmanifestonly</td>
  132. <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>
  133. <td valign="top" align="center">No</td>
  134. </tr>
  135. <tr>
  136. <td valign="top">manifestencoding</td>
  137. <td valign="top">The encoding used to read the JAR manifest, when a manifest file is specified.</td>
  138. <td valign="top" align="center">No, defaults to the platform encoding.</td>
  139. </tr>
  140. <tr>
  141. <td valign="top">index</td>
  142. <td valign="top">whether to create an <A
  143. HREF="http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#JAR%20Index">index
  144. list</A> to speed up classloading. This is a JDK 1.3+ specific
  145. feature. Unless you specify additional jars with nested <a
  146. href="jar.html#indexjars"><code>indexjars</code></a> elements, only the
  147. contents of this jar will be included in the index. Defaults to
  148. false.</td>
  149. <td valign="top" align="center">No</td>
  150. </tr>
  151. <tr>
  152. <td valign="top">indexMetaInf</td>
  153. <td valign="top">whether to include META-INF and its children in
  154. the index. Doesn't have any effect if <em>index</em> is
  155. false.<br/>
  156. Sun's jar implementation used to skip the META-INF directory and
  157. Ant followed that example. The behavior has been changed with
  158. <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4408526">Java
  159. 5</a>. In order to avoid problems with Ant generated jars on
  160. Java 1.4 or earlier Ant will not include META-INF unless
  161. explicitly asked to.<br/>
  162. <em>Ant 1.8.0</em> - Defaults to false.</td>
  163. <td valign="top" align="center">No</td>
  164. </tr>
  165. <tr>
  166. <td valign="top">update</td>
  167. <td valign="top">indicates whether to update or overwrite
  168. the destination file if it already exists. Default is &quot;false&quot;.</td>
  169. <td valign="top" align="center">No</td>
  170. </tr>
  171. <tr>
  172. <td valign="top">duplicate</td>
  173. <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>
  174. <td valign="top" align="center">No</td>
  175. </tr>
  176. <tr>
  177. <td valign="top">roundup</td>
  178. <td valign="top">Whether the file modification times will be
  179. rounded up to the next even number of seconds.<br>
  180. Zip archives store file modification times with a granularity of
  181. two seconds, so the times will either be rounded up or down. If
  182. you round down, the archive will always seem out-of-date when you
  183. rerun the task, so the default is to round up. Rounding up may
  184. lead to a different type of problems like JSPs inside a web
  185. archive that seem to be slightly more recent than precompiled
  186. pages, rendering precompilation useless.<br>
  187. Defaults to true. <em>Since Ant 1.6.2</em></td>
  188. <td align="center" valign="top">No</td>
  189. </tr>
  190. <tr>
  191. <td valign="top">level</td>
  192. <td valign="top">Non-default level at which file compression should be
  193. performed. Valid values range from 0 (no compression/fastest) to 9
  194. (maximum compression/slowest). <em>Since Ant 1.7</em></td>
  195. <td valign="top" align="center">No</td>
  196. </tr>
  197. <tr>
  198. <td valign="top">preserve0permissions</td>
  199. <td valign="top">when updating an archive or adding entries from a
  200. different archive Ant will assume that a Unix permissions value of
  201. 0 (nobody is allowed to do anything to the file/directory) means
  202. that the permissions haven't been stored at all rather than real
  203. permissions and will instead apply its own default values.<br/>
  204. Set this attribute to true if you really want to preserve the
  205. original permission field.<em>since Ant 1.8.0</em>
  206. </td>
  207. <td valign="top" align="center">No, default is false</td>
  208. </tr>
  209. <tr>
  210. <td valign="top">useLanguageEncodingFlag</td>
  211. <td valign="top">Whether to set the language encoding flag if the
  212. encoding is UTF-8. This setting doesn't have any effect if the
  213. encoding is not UTF-8.
  214. <em>Since Ant 1.8.0</em>.
  215. <br/>See also the <a href="zip.html#encoding">discussion in the
  216. zip task page</a></td>
  217. <td valign="top" align="center">No, default is true</td>
  218. </tr>
  219. <tr>
  220. <td valign="top">createUnicodeExtraFields</td>
  221. <td valign="top">Whether to create unicode extra fields to store
  222. the file names a second time inside the entry's metadata.
  223. <br>Possible values are "never", "always" and "not-encodable"
  224. which will only add Unicode extra fields if the file name cannot
  225. be encoded using the specified encoding.
  226. <em>Since Ant 1.8.0</em>.
  227. <br/>See also the <a href="zip.html#encoding">discussion in the
  228. zip task page</a></td>
  229. <td align="center" valign="top">No, default is "never"</td>
  230. </tr>
  231. <tr>
  232. <td valign="top">fallbacktoUTF8</td>
  233. <td valign="top">Whether to use UTF-8 and the language encoding
  234. flag instead of the specified encoding if a file name cannot be
  235. encoded using the specified encoding.
  236. <em>Since Ant 1.8.0</em>.
  237. <br/>See also the <a href="zip.html#encoding">discussion in the
  238. zip task page</a></td>
  239. <td align="center" valign="top">No, default is false</td>
  240. </tr>
  241. <tr>
  242. <td valign="top">mergeClassPathAttributes</td>
  243. <td valign="top">Whether to merge the Class-Path attributes found
  244. in different manifests (if merging manifests). If false, only
  245. the attribute of the last merged manifest will be preserved.
  246. <em>Since Ant 1.8.0</em>.
  247. <br/>unless you also set flattenAttributes to true this may
  248. result in manifests containing multiple Class-Path attributes
  249. which violates the manifest specification.</td>
  250. <td align="center" valign="top">No, default is false</td>
  251. </tr>
  252. <tr>
  253. <td valign="top">flattenAttributes</td>
  254. <td valign="top">Whether to merge attributes occuring more than
  255. once in a section (this can only happen for the Class-Path
  256. attribute) into a single attribute.
  257. <em>Since Ant 1.8.0</em>.</td>
  258. <td align="center" valign="top">No, default is false</td>
  259. </tr>
  260. </table>
  261. <h3>Nested elements</h3>
  262. <h4>metainf</h4>
  263. <p>The nested <code>metainf</code> element specifies a <a
  264. href="../CoreTypes/fileset.html">FileSet</a>. All files included in this fileset will
  265. end up in the <code>META-INF</code> directory of the ear file. If this
  266. fileset includes a file named <code>MANIFEST.MF</code>, the file is
  267. ignored and you will get a warning.</p>
  268. <h4>manifest, indexjars, service</h4>
  269. These are inherited from <a href="jar.html">&lt;jar&gt;</a>
  270. <h2>Example</h2>
  271. <pre>
  272. &lt;ear destfile=&quot;${build.dir}/myapp.ear&quot; appxml=&quot;${src.dir}/metadata/application.xml&quot;&gt;
  273. &lt;fileset dir=&quot;${build.dir}&quot; includes=&quot;*.jar,*.war&quot;/&gt;
  274. &lt;/ear&gt;
  275. </pre>
  276. </body>
  277. </html>