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 5.9 kB

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