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.5 kB

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