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

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