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 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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.<br>
  44. </p>
  45. <p>A tarfileset can be defined with the <span style="font-style:
  46. italic;">id </span>attribute and referred to with the <span
  47. style="font-style: italic;">refid</span> attribute. This is also true
  48. for tarfileset which has been added in Ant 1.7.<br>
  49. </p>
  50. <h3>Parameters</h3>
  51. <table border="1" cellpadding="2" cellspacing="0">
  52. <tbody>
  53. <tr>
  54. <td valign="top"><b>Attribute</b></td>
  55. <td valign="top"><b>Description</b></td>
  56. <td valign="top" align="center"><b>Required</b></td>
  57. </tr>
  58. <tr>
  59. <td valign="top">prefix</td>
  60. <td valign="top">all files in the fileset are prefixed with that
  61. path in the archive.</td>
  62. <td align="center" valign="top">No</td>
  63. </tr>
  64. <tr>
  65. <td valign="top">fullpath</td>
  66. <td valign="top">the file described by the fileset is placed at
  67. that exact location in the archive.</td>
  68. <td align="center" valign="top">No</td>
  69. </tr>
  70. <tr>
  71. <td valign="top">src</td>
  72. <td valign="top">may be used in place of the <i>dir</i> attribute
  73. to specify a tar file whose contents will be extracted and included
  74. in the archive.</td>
  75. <td align="center" valign="top">No</td>
  76. </tr>
  77. <tr>
  78. <td valign="top">filemode</td>
  79. <td valign="top">A 3 digit octal string, specify the user, group
  80. and other modes in the standard Unix fashion. Only applies to
  81. plain files. Default is 644.</td>
  82. <td align="center" valign="top">No</td>
  83. </tr>
  84. <tr>
  85. <td valign="top">dirmode</td>
  86. <td valign="top">A 3 digit octal string, specify the user, group
  87. and other modes in the standard Unix fashion. Only applies to
  88. directories. Default is 755.</td>
  89. <td align="center" valign="top">No</td>
  90. </tr>
  91. <tr>
  92. <td valign="top">username</td>
  93. <td valign="top">The username for the tar entry. This is not the same as the UID.
  94. </td>
  95. <td align="center" valign="top">No</td>
  96. </tr>
  97. <tr>
  98. <td valign="top">group</td>
  99. <td valign="top">The groupname for the tar entry. This is not the same as the GID.
  100. </td>
  101. <td align="center" valign="top">No</td>
  102. </tr>
  103. <tr>
  104. <td valign="top">uid</td>
  105. <td valign="top">The user identifier (UID) for the tar entry. This is an integer value
  106. and is not the same as the username.
  107. </td>
  108. <td align="center" valign="top">No</td>
  109. </tr>
  110. <tr>
  111. <td valign="top">gid</td>
  112. <td valign="top">The group identifier (GID) for the tar entry.
  113. </td>
  114. <td align="center" valign="top">No</td>
  115. </tr>
  116. <tr>
  117. <td valign="top">erroronmissingarchive</td>
  118. <td valign="top">
  119. Specify what happens if the archive does not exist.
  120. If true, a build error will happen; if false, the fileset
  121. will be ignored/empty.
  122. Defaults to true.
  123. <em>Since Ant 1.8.0</em>
  124. </td>
  125. <td valign="top" align="center">No</td>
  126. </tr>
  127. </tbody>
  128. </table>
  129. <p>The <i>fullpath</i> attribute can only be set for filesets that
  130. represent a single file. The <i>prefix</i> and <i>fullpath</i>
  131. attributes cannot both be set on the same fileset.</p>
  132. <p>When using the <i>src</i> attribute, include and exclude patterns
  133. may be used to specify a subset of the archive for inclusion in the
  134. archive as with the <i>dir</i> attribute.</p>
  135. <p>Please note that currently only the <a
  136. href="../Tasks/tar.html">tar</a> task uses the permission and
  137. ownership attributes.</p>
  138. <h3>Parameters specified as nested elements</h3>
  139. <h4>any <a href="resources.html">resource</a> or single element
  140. resource collection</h4>
  141. <p>The specified resource will be used as src.</p>
  142. <h4>Examples</h4>
  143. <blockquote>
  144. <pre>
  145. &lt;copy todir="some-dir"&gt;
  146. &lt;tarfileset includes="lib/**"&gt;
  147. &lt;bzip2resource&gt;
  148. &lt;url url="http://example.org/dist/some-archive.tar.bz2"/&gt;
  149. &lt;/bzip2resource&gt;
  150. &lt;/tarfileset&gt;
  151. &lt;/copy&gt;
  152. </pre></blockquote>
  153. <p>downloads the archive some-archive.tar.bz2, uncompresses and
  154. extracts it on the fly, copies the contents of the lib directory into
  155. some-dir and discards the rest of the archive. File timestamps will
  156. be compared between the archive's entries and files inside the target
  157. directory, no files get overwritten unless they are out-of-date.</p>
  158. </body>
  159. </html>