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.

tarfileset.html 6.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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>TarFileSet Type</title>
  20. </head>
  21. <body>
  22. <h2 id="fileset">TarFileSet</h2>
  23. <p><em>TarFileSet</em> has been added as a stand-alone type in Apache Ant
  24. 1.7.</p>
  25. <p>A <code>&lt;tarfileset&gt;</code> is a special form of a <code>&lt;<a
  26. href="fileset.html">fileset</a>&gt;</code> which can behave in 2
  27. different ways : <br>
  28. </p>
  29. <ul>
  30. <li>When the <span style="font-style: italic;">src</span> attribute
  31. is used - or a nested resource collection has been specified, the
  32. tarfileset is populated with tar entries found in the file <span
  33. style="font-style: italic;">src</span>.<br>
  34. </li>
  35. <li>When the <span style="font-style: italic;">dir</span> attribute
  36. is used, the tarfileset is populated with filesystem files found under <span
  37. style="font-style: italic;">dir</span>.<br>
  38. </li>
  39. </ul>
  40. <p><code>&lt;tarfileset&gt;</code> supports all attributes of <code>&lt;<a
  41. href="fileset.html">fileset</a>&gt;</code>
  42. in addition to those listed below. Note that tar archives in general
  43. don't contain entries with leading slashes so you shouldn't use
  44. include/exclude patterns that start with slashes either.
  45. </p>
  46. <p>A tarfileset can be defined with the <span style="font-style:
  47. italic;">id </span>attribute and referred to with the <span
  48. style="font-style: italic;">refid</span> attribute. This is also true
  49. for tarfileset which has been added in Ant 1.7.<br>
  50. </p>
  51. <h3>Parameters</h3>
  52. <table>
  53. <tbody>
  54. <tr>
  55. <td valign="top"><b>Attribute</b></td>
  56. <td valign="top"><b>Description</b></td>
  57. <td valign="top" align="center"><b>Required</b></td>
  58. </tr>
  59. <tr>
  60. <td valign="top">prefix</td>
  61. <td valign="top">all files in the fileset are prefixed with that
  62. path in the archive.</td>
  63. <td align="center" valign="top">No</td>
  64. </tr>
  65. <tr>
  66. <td valign="top">fullpath</td>
  67. <td valign="top">the file described by the fileset is placed at
  68. that exact location in the archive.</td>
  69. <td align="center" valign="top">No</td>
  70. </tr>
  71. <tr>
  72. <td valign="top">src</td>
  73. <td valign="top">may be used in place of the <i>dir</i> attribute
  74. to specify a tar file whose contents will be extracted and included
  75. in the archive.</td>
  76. <td align="center" valign="top">No</td>
  77. </tr>
  78. <tr>
  79. <td valign="top">filemode</td>
  80. <td valign="top">A 3 digit octal string, specify the user, group
  81. and other modes in the standard Unix fashion. Only applies to
  82. plain files. Default is 644.</td>
  83. <td align="center" valign="top">No</td>
  84. </tr>
  85. <tr>
  86. <td valign="top">dirmode</td>
  87. <td valign="top">A 3 digit octal string, specify the user, group
  88. and other modes in the standard Unix fashion. Only applies to
  89. directories. Default is 755.</td>
  90. <td align="center" valign="top">No</td>
  91. </tr>
  92. <tr>
  93. <td valign="top">username</td>
  94. <td valign="top">The username for the tar entry. This is not the same as the UID.
  95. </td>
  96. <td align="center" valign="top">No</td>
  97. </tr>
  98. <tr>
  99. <td valign="top">group</td>
  100. <td valign="top">The groupname for the tar entry. This is not the same as the GID.
  101. </td>
  102. <td align="center" valign="top">No</td>
  103. </tr>
  104. <tr>
  105. <td valign="top">uid</td>
  106. <td valign="top">The user identifier (UID) for the tar entry. This is an integer value
  107. and is not the same as the username.
  108. </td>
  109. <td align="center" valign="top">No</td>
  110. </tr>
  111. <tr>
  112. <td valign="top">gid</td>
  113. <td valign="top">The group identifier (GID) for the tar entry.
  114. </td>
  115. <td align="center" valign="top">No</td>
  116. </tr>
  117. <tr>
  118. <td valign="top">erroronmissingarchive</td>
  119. <td valign="top">
  120. Specify what happens if the archive does not exist.
  121. If true, a build error will happen; if false, the fileset
  122. will be ignored/empty.
  123. Defaults to true.
  124. <em>Since Ant 1.8.0</em>
  125. </td>
  126. <td valign="top" align="center">No</td>
  127. </tr>
  128. <tr>
  129. <td valign="top">encoding</td>
  130. <td valign="top">The character encoding to use for filenames
  131. inside the zip file. For a list of possible values see the <a
  132. href="http://docs.oracle.com/javase/7/docs/technotes/guides/intl/encoding.doc.html">Supported Encodings</a>.
  133. Defaults to the platform's default character encoding.
  134. <em>Since Ant 1.9.5</em>
  135. <td align="center" valign="top">No</td>
  136. </tr>
  137. </tbody>
  138. </table>
  139. <p>The <i>fullpath</i> attribute can only be set for filesets that
  140. represent a single file. The <i>prefix</i> and <i>fullpath</i>
  141. attributes cannot both be set on the same fileset.</p>
  142. <p>When using the <i>src</i> attribute, include and exclude patterns
  143. may be used to specify a subset of the archive for inclusion in the
  144. archive as with the <i>dir</i> attribute.</p>
  145. <p>Please note that currently only the <a
  146. href="../Tasks/tar.html">tar</a> task uses the permission and
  147. ownership attributes.</p>
  148. <h3>Parameters specified as nested elements</h3>
  149. <h4>any <a href="resources.html">resource</a> or single element
  150. resource collection</h4>
  151. <p>The specified resource will be used as src.</p>
  152. <h4>Examples</h4>
  153. <blockquote>
  154. <pre>
  155. &lt;copy todir="some-dir"&gt;
  156. &lt;tarfileset includes="lib/**"&gt;
  157. &lt;bzip2resource&gt;
  158. &lt;url url="http://example.org/dist/some-archive.tar.bz2"/&gt;
  159. &lt;/bzip2resource&gt;
  160. &lt;/tarfileset&gt;
  161. &lt;/copy&gt;
  162. </pre></blockquote>
  163. <p>downloads the archive some-archive.tar.bz2, uncompresses and
  164. extracts it on the fly, copies the contents of the lib directory into
  165. some-dir and discards the rest of the archive. File timestamps will
  166. be compared between the archive's entries and files inside the target
  167. directory, no files get overwritten unless they are out-of-date.</p>
  168. </body>
  169. </html>