| <html> |
| |
| <head> |
| <meta http-equiv="Content-Language" content="en-us"> |
| <title>Ant User Manual</title> |
| </head> |
| |
| <body> |
| |
| <h2><a name="patternset">PatternSet</a></h2> |
| <p>Patterns can be grouped to sets and later be referenced by their |
| <code>id</code> |
| attribute. They are defined via a <code>patternset</code> element, |
| which can appear nested into a <a href="fileset.html">FileSet</a> or a |
| directory-based task that constitutes an implicit FileSet. In addition, |
| <code>patternset</code>s can be defined at the same level as |
| <code>target</code> — i.e., as children of <code>project</code>.</p> |
| <p>Patterns can be specified by nested <code><include></code> or |
| <code><exclude></code> elements or the following attributes.</p> |
| <table border="1" cellpadding="2" cellspacing="0"> |
| <tr> |
| <td valign="top"><b>Attribute</b></td> |
| <td valign="top"><b>Description</b></td> |
| </tr> |
| <tr> |
| <td valign="top">includes</td> |
| <td valign="top">comma-separated list of patterns of files that must be |
| included. All files are included when omitted.</td> |
| </tr> |
| <tr> |
| <td valign="top">includesfile</td> |
| <td valign="top">the name of a file; each line of this file is |
| taken to be an include pattern.</td> |
| </tr> |
| <tr> |
| <td valign="top">excludes</td> |
| <td valign="top">comma-separated list of patterns of files that must be |
| excluded; no files (except default excludes) are excluded when omitted.</td> |
| </tr> |
| <tr> |
| <td valign="top">excludesfile</td> |
| <td valign="top">the name of a file; each line of this file is |
| taken to be an exclude pattern.</td> |
| </tr> |
| </table> |
| |
| <h4>Examples</h4> |
| <blockquote><pre> |
| <patternset id="non.test.sources" > |
| <include name="**/*.java"/> |
| <exclude name="**/*Test*"/> |
| </patternset> |
| </pre></blockquote> |
| <p>Builds a set of patterns that matches all <code>.java</code> files |
| that do not contain the text <code>Test</code> in their name. This set |
| can be <a href="../using.html#references">referred</a> to via |
| <code><patternset refid="non.test.sources"/></code>, |
| by tasks that support this feature, or by FileSets.</p> |
| <p>Note that while the <code>includes</code> and |
| <code>excludes</code> attributes accept |
| multiple elements separated by commas or spaces, the nested |
| <include> and <exclude> elements expect their name |
| attribute to hold a single pattern.</p> |
| <p>The nested <include> and <exclude> elements allow you to use |
| if and unless arguments to specify that the element should only be used if a |
| property is set, or that it should be used only if a property is not set.</p> |
| <p>For example</p> |
| <blockquote><pre> |
| <patternset id="sources" > |
| <include name="std/**/*.java"/> |
| <include name="prof/**/*.java" if="professional"/> |
| <exclude name="**/*Test*"/> |
| </patternset> |
| </pre></blockquote> |
| <p>will only include the files in the sub-directory <em>prof</em> if the property |
| <em>professional</em> is set to some value.</p> |
| |
| <hr> |
| <p align="center">Copyright © 2000,2001 Apache Software Foundation. All rights |
| Reserved.</p> |
| |
| </body> |
| </html> |
| |