2018-12-21 11:20:43 +01:00
|
|
|
<!DOCTYPE html>
|
2006-09-11 04:19:00 +00:00
|
|
|
<!--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
2019-05-25 13:41:47 +02:00
|
|
|
https://www.apache.org/licenses/LICENSE-2.0
|
2006-09-11 04:19:00 +00:00
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
2018-12-21 11:20:43 +01:00
|
|
|
<html lang="en">
|
2001-02-13 12:32:01 +00:00
|
|
|
|
|
|
|
<head>
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
2002-02-03 22:11:39 +00:00
|
|
|
<title>FileSet Type</title>
|
2001-02-13 12:32:01 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2018-02-08 16:59:52 +01:00
|
|
|
<h2 id="fileset">FileSet</h2>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>A FileSet is a group of files. These files can be found in a directory tree starting in a
|
|
|
|
base directory and are matched by patterns taken from a number
|
|
|
|
of <a href="patternset.html">PatternSets</a> and <a href="selectors.html">Selectors</a>.</p>
|
2018-03-10 20:17:33 +01:00
|
|
|
<p>PatternSets can be specified as nested <code><patternset></code> elements. In
|
2018-02-28 07:58:59 +01:00
|
|
|
addition, FileSet holds an implicit PatternSet and supports the
|
|
|
|
nested <code><include></code>, <code><includesfile></code>, <code><exclude></code>
|
|
|
|
and <code><excludesfile></code> elements of PatternSet directly, as well as PatternSet's
|
2001-08-01 09:08:56 +00:00
|
|
|
attributes.</p>
|
2018-06-08 20:17:29 +02:00
|
|
|
<p>Selectors are available as nested elements within the FileSet. If any of the selectors
|
2018-02-28 07:58:59 +01:00
|
|
|
within the FileSet do not select the file, the file is not considered part of the FileSet. This
|
|
|
|
makes a FileSet equivalent to an <code><and></code> selector container.</p>
|
|
|
|
<table class="attr">
|
2001-02-13 12:32:01 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>dir</td>
|
|
|
|
<td>the root of the directory tree of this FileSet.</td>
|
|
|
|
<td rowspan="2">Exactly one of dir or file must be specified</td>
|
2003-10-03 04:53:44 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>file</td>
|
|
|
|
<td class="left">shortcut for specifying a single-file fileset</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>defaultexcludes</td>
|
|
|
|
<td>indicates whether <a href="../dirtasks.html#defaultexcludes">default excludes</a> should
|
|
|
|
be used or not (<code>yes|no</code>).</td>
|
|
|
|
<td>No; defaults to <q>yes</q></td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>includes</td>
|
|
|
|
<td>comma- or space-separated list of patterns of files that must be included.</td>
|
|
|
|
<td>No; defaults to all files</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>includesfile</td>
|
|
|
|
<td>name of a file; each line of this file is taken to be an include pattern.<br/>
|
|
|
|
<strong>Note</strong>: if the file is empty and there are no other patterns defined for
|
|
|
|
the fileset, all files will be included.
|
2015-03-07 12:32:13 +01:00
|
|
|
</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>excludes</td>
|
|
|
|
<td>comma- or space-separated list of patterns of files that must be excluded.</td>
|
|
|
|
<td>No; defaults to default excludes or none if <var>defaultexcludes</var> is <q>no</q></td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>excludesfile</td>
|
|
|
|
<td>name of a file; each line of this file is taken to be an exclude pattern.</td>
|
|
|
|
<td>No</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
2001-09-30 13:21:54 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>casesensitive</td>
|
|
|
|
<td>Must the include and exclude patterns be treated in a case sensitive way?</td>
|
|
|
|
<td>No; defaults to <q>true</q></td>
|
2001-09-30 13:21:54 +00:00
|
|
|
</tr>
|
2002-06-01 12:26:43 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>followsymlinks</td>
|
|
|
|
<td>Shall symbolic links be followed? See the note <a href="#symlink">below</a>.</td>
|
|
|
|
<td>No; defaults to <q>true</q></td>
|
2002-06-01 12:26:43 +00:00
|
|
|
</tr>
|
2007-08-22 08:16:49 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>erroronmissingdir</td>
|
|
|
|
<td>
|
2018-06-08 20:17:29 +02:00
|
|
|
Specify what happens if the base directory does not exist. If <q>true</q> a build error
|
2018-02-28 07:58:59 +01:00
|
|
|
will happen, if <q>false</q>, the fileset will be ignored/empty.
|
|
|
|
<em>Since Apache Ant 1.7.1</em>
|
2007-08-22 08:55:18 +00:00
|
|
|
</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No; defaults to <q>true</q> (for backward compatibility reasons)</td>
|
2007-08-22 08:16:49 +00:00
|
|
|
</tr>
|
2020-08-23 14:18:36 +02:00
|
|
|
<tr>
|
|
|
|
<td>refid</td>
|
|
|
|
<td>Makes this <code>fileset</code>
|
|
|
|
a <a href="../using.html#references">reference</a> to
|
|
|
|
a <code>fileset</code> defined elsewhere. If specified no other
|
|
|
|
attributes or nested elements are allowed.</td>
|
|
|
|
<td>No</td>
|
|
|
|
</tr>
|
2001-02-13 12:32:01 +00:00
|
|
|
</table>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p id="symlink"><strong>Note</strong>: All files/directories for which the canonical path is
|
2018-06-08 20:17:29 +02:00
|
|
|
different from its path are considered symbolic links. On Unix systems this usually means the
|
2018-02-28 07:58:59 +01:00
|
|
|
file really is a symbolic link but it may lead to false results on other platforms.</p>
|
2002-06-01 12:26:43 +00:00
|
|
|
|
2018-06-08 20:17:29 +02:00
|
|
|
<p>Ant is restricted to features that JRE considers portable, and symbolic links is one such feature
|
|
|
|
that was long considered non-portable. That has changed with Java 7 and NIO.2, yet full support for
|
|
|
|
symbolic links is still lacking (notably, in Zip files). Full support of symbolic links in Ant would
|
|
|
|
require a different implementation of FileSet and revision of all tasks and/or types that derive
|
|
|
|
from it. Currently, the semantics of <var>followsymlinks</var> in FileSet is such that <q>false</q>
|
|
|
|
excludes symbolic links completely, and <q>true</q> allows symbolic links to be considered by
|
|
|
|
selectors, which may have their own <var>followsymlinks</var> attributes with proper semantics;
|
|
|
|
i.e., <q>false</q> allows selector to inspect properties of a symbolic link itself, and <q>true</q>
|
|
|
|
those of its target.
|
|
|
|
</p>
|
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
<h4>Examples</h4>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2002-09-04 11:05:19 +00:00
|
|
|
<fileset dir="${server.src}" casesensitive="yes">
|
2002-03-28 23:39:19 +00:00
|
|
|
<include name="**/*.java"/>
|
|
|
|
<exclude name="**/*Test*"/>
|
|
|
|
</fileset>
|
2018-02-09 06:54:03 +01:00
|
|
|
</pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Groups all files in directory <samp>${server.src}</samp> that are Java source files and don't
|
|
|
|
have the text <samp>Test</samp> in their name.</p>
|
2005-10-14 18:41:07 +00:00
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2002-09-04 11:05:19 +00:00
|
|
|
<fileset dir="${server.src}" casesensitive="yes">
|
|
|
|
<patternset id="non.test.sources">
|
2001-02-13 12:32:01 +00:00
|
|
|
<include name="**/*.java"/>
|
|
|
|
<exclude name="**/*Test*"/>
|
|
|
|
</patternset>
|
|
|
|
</fileset>
|
2018-02-09 06:54:03 +01:00
|
|
|
</pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Groups the same files as the above example, but also establishes a PatternSet that can be
|
|
|
|
referenced in other <code><fileset></code> elements, rooted at a different directory.</p>
|
2005-10-14 18:41:07 +00:00
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2001-02-13 12:32:01 +00:00
|
|
|
<fileset dir="${client.src}" >
|
|
|
|
<patternset refid="non.test.sources"/>
|
|
|
|
</fileset>
|
2018-02-09 06:54:03 +01:00
|
|
|
</pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Groups all files in directory <samp>${client.src}</samp>, using the same patterns as the
|
|
|
|
above example.</p>
|
2005-10-14 18:41:07 +00:00
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2003-02-04 17:29:11 +00:00
|
|
|
<fileset dir="${server.src}" casesensitive="yes">
|
|
|
|
<filename name="**/*.java"/>
|
|
|
|
<filename name="**/*Test*" negate="true"/>
|
|
|
|
</fileset>
|
2018-02-09 06:54:03 +01:00
|
|
|
</pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Groups the same files as the top example, but using the <code><filename></code>
|
|
|
|
selector.</p>
|
2005-10-14 18:41:07 +00:00
|
|
|
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2003-02-04 17:29:11 +00:00
|
|
|
<fileset dir="${server.src}" casesensitive="yes">
|
|
|
|
<filename name="**/*.java"/>
|
|
|
|
<not>
|
|
|
|
<filename name="**/*Test*"/>
|
|
|
|
</not>
|
|
|
|
</fileset>
|
2018-02-09 06:54:03 +01:00
|
|
|
</pre>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Groups the same files as the previous example using a combination of
|
|
|
|
the <code><filename></code> selector and the <code><not></code> selector
|
|
|
|
container.</p>
|
2001-02-13 12:32:01 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre><fileset dir="src" includes="main/"/></pre>
|
|
|
|
<p>Selects all files in <samp>src/main</samp> (e.g. <samp>src/main/Foo.java</samp>
|
|
|
|
or <samp>src/main/application/Bar.java</samp>).</p>
|
2005-10-14 18:41:07 +00:00
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
</body>
|
|
|
|
</html>
|