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.

fileset.html 6.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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>FileSet Type</title>
  20. </head>
  21. <body>
  22. <h2><a name="fileset">FileSet</a></h2>
  23. <p>A FileSet is a group of files. These files can be found in a
  24. directory tree starting in a base directory and are matched by
  25. patterns taken from a number of <a
  26. href="patternset.html">PatternSets</a> and
  27. <a href="selectors.html">Selectors</a>.
  28. <p>PatternSets can be specified as nested
  29. <code>&lt;patternset&gt;</code> elements. In addition, FileSet holds
  30. an implicit PatternSet and supports the nested
  31. <code>&lt;include&gt;</code>, <code>&lt;includesfile&gt;</code>,
  32. <code>&lt;exclude&gt;</code> and <code>&lt;excludesfile&gt;</code>
  33. elements of PatternSet directly, as well as PatternSet's
  34. attributes.</p>
  35. <p>Selectors are available as nested elements within the FileSet.
  36. If any of the selectors within the FileSet do not select the file, the
  37. file is not considered part of the FileSet. This makes a FileSet
  38. equivalent to an <code>&lt;and&gt;</code> selector container.</p>
  39. <table border="1" cellpadding="2" cellspacing="0">
  40. <tr>
  41. <td valign="top"><b>Attribute</b></td>
  42. <td valign="top"><b>Description</b></td>
  43. <td align="center" valign="top"><b>Required</b></td>
  44. </tr>
  45. <tr>
  46. <td valign="top">dir</td>
  47. <td valign="top">the root of the directory tree of this FileSet.</td>
  48. <td valign="middle" align="center" rowspan="2">Either dir or file must be specified</td>
  49. </tr>
  50. <tr>
  51. <td valign="top">file</td>
  52. <td valign="top">shortcut for specifying a single-file fileset</td>
  53. </tr>
  54. <tr>
  55. <td valign="top">defaultexcludes</td>
  56. <td valign="top">indicates whether <a href="../dirtasks.html#defaultexcludes">default excludes</a> should be used or not
  57. (<code>yes | no</code>); default excludes are used when omitted.</td>
  58. <td valign="top" align="center">No</td>
  59. </tr>
  60. <tr>
  61. <td valign="top">includes</td>
  62. <td valign="top">comma- or space-separated list of patterns of files that must be
  63. included; all files are included when omitted.</td>
  64. <td valign="top" align="center">No</td>
  65. </tr>
  66. <tr>
  67. <td valign="top">includesfile</td>
  68. <td valign="top">the name of a file; each line of this file is
  69. taken to be an include pattern.</td>
  70. <td valign="top" align="center">No</td>
  71. </tr>
  72. <tr>
  73. <td valign="top">excludes</td>
  74. <td valign="top">comma- or space-separated list of patterns of files that must be
  75. excluded; no files (except default excludes) are excluded when omitted.</td>
  76. <td valign="top" align="center">No</td>
  77. </tr>
  78. <tr>
  79. <td valign="top">excludesfile</td>
  80. <td valign="top">the name of a file; each line of this file is
  81. taken to be an exclude pattern.</td>
  82. <td valign="top" align="center">No</td>
  83. </tr>
  84. <tr>
  85. <td valign="top">casesensitive</td>
  86. <td valign="top">Must the include and exclude patterns be treated in a case sensitive way?
  87. Defaults to true.</td>
  88. <td valign="top" align="center">No</td>
  89. </tr>
  90. <tr>
  91. <td valign="top">followsymlinks</td>
  92. <td valign="top">Shall symbolic links be followed? Defaults to
  93. true. See the note <a href="#symlink">below</a>.</td>
  94. <td valign="top" align="center">No</td>
  95. </tr>
  96. <tr>
  97. <td valign="top">erroronmissingdir</td>
  98. <td valign="top">
  99. Specify what happens if the base directory does not exist.
  100. If true a build error will happen, if false, the fileset
  101. will be ignored/empty.
  102. Defaults to true.
  103. <em>Since Apache Ant 1.7.1 (default is true for backward compatibility
  104. reasons.)</em>
  105. </td>
  106. <td valign="top" align="center">No</td>
  107. </tr>
  108. </table>
  109. <p><a name="symlink"><b>Note</b></a>: All files/directories for which
  110. the canonical path is different from its path are considered symbolic
  111. links. On Unix systems this usually means the file really is a
  112. symbolic link but it may lead to false results on other
  113. platforms.</p>
  114. <h4>Examples</h4>
  115. <blockquote><pre>
  116. &lt;fileset dir=&quot;${server.src}&quot; casesensitive=&quot;yes&quot;&gt;
  117. &lt;include name=&quot;**/*.java&quot;/&gt;
  118. &lt;exclude name=&quot;**/*Test*&quot;/&gt;
  119. &lt;/fileset&gt;
  120. </pre></blockquote>
  121. <p>Groups all files in directory <code>${server.src}</code> that are Java
  122. source files and don't have the text <code>Test</code> in their
  123. name.</p>
  124. <blockquote><pre>
  125. &lt;fileset dir=&quot;${server.src}&quot; casesensitive=&quot;yes&quot;&gt;
  126. &lt;patternset id=&quot;non.test.sources&quot;&gt;
  127. &lt;include name=&quot;**/*.java&quot;/&gt;
  128. &lt;exclude name=&quot;**/*Test*&quot;/&gt;
  129. &lt;/patternset&gt;
  130. &lt;/fileset&gt;
  131. </pre></blockquote>
  132. <p>Groups the same files as the above example, but also establishes
  133. a PatternSet that can be referenced in other
  134. <code>&lt;fileset&gt;</code> elements, rooted at a different directory.</p>
  135. <blockquote><pre>
  136. &lt;fileset dir=&quot;${client.src}&quot; &gt;
  137. &lt;patternset refid=&quot;non.test.sources&quot;/&gt;
  138. &lt;/fileset&gt;
  139. </pre></blockquote>
  140. <p>Groups all files in directory <code>${client.src}</code>, using the
  141. same patterns as the above example.</p>
  142. <blockquote><pre>
  143. &lt;fileset dir=&quot;${server.src}&quot; casesensitive=&quot;yes&quot;&gt;
  144. &lt;filename name=&quot;**/*.java&quot;/&gt;
  145. &lt;filename name=&quot;**/*Test*&quot; negate=&quot;true&quot;/&gt;
  146. &lt;/fileset&gt;
  147. </pre></blockquote>
  148. <p>Groups the same files as the top example, but using the
  149. <code>&lt;filename&gt;</code> selector.</p>
  150. <blockquote><pre>
  151. &lt;fileset dir=&quot;${server.src}&quot; casesensitive=&quot;yes&quot;&gt;
  152. &lt;filename name=&quot;**/*.java&quot;/&gt;
  153. &lt;not&gt;
  154. &lt;filename name=&quot;**/*Test*&quot;/&gt;
  155. &lt;/not&gt;
  156. &lt;/fileset&gt;
  157. </pre></blockquote>
  158. <p>Groups the same files as the previous example using a combination of the
  159. <code>&lt;filename&gt;</code> selector and the <code>&lt;not&gt;</code>
  160. selector container.</p>
  161. <blockquote><pre>
  162. &lt;fileset dir="src" includes="main/" /&gt;
  163. </pre></blockquote>
  164. <p>Selects all files in <i>src/main</i> (e.g. <i>src/main/Foo.java</i> or
  165. <i>src/main/application/Bar.java</i>).</p>
  166. </body>
  167. </html>