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.3 KiB

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