Patterns can be grouped to
sets and later be referenced by their id attribute. They
are defined via a patternset element, which can appear
nested into a FileSet or a directory-based
task that constitutes an implicit FileSet. In addition,
patternsets can be defined as a stand alone element at
the same level as target i.e., as children of
project as well as as children of
target.
パターンを集合にまとめ、
後でそのid属性により参照できるようにすることができます。
これはpatternset要素により定義されます。
これは、
ファイルセットの子としてネストされているか、
暗黙的なファイルセットを構成するディレクトリベースのタスクに現れます。
それに加え、
patternsetは
targetと同じレベルの単独の要素として定義できます。
即ち、
targetの子と同様に
projectの子としても定義できます。
Patterns can be specified by nested
<include>, or <exclude> elements
or the following attributes.
パターンはネストされた
<include>または
<exclude>要素、あるいは次の属性により指定されます。
| Attribute | Description |
| includes | comma- or space-separated list of patterns of files that must be included. All files are included when omitted. |
| includesfile | the name of a file; each line of this file is taken to be an include pattern. You can specify more than one include file by using a nested includesfile elements. |
| excludes | comma- or space-separated list of patterns of files that must be excluded; no files (except default excludes) are excluded when omitted. |
| excludesfile | the name of a file; each line of this file is taken to be an exclude pattern. You can specify more than one exclude file by using a nested excludesfile elements. |
| 属性 | 説明 |
| includes | カンマあるいは空白で区切られた選択されるファイルのパターンのリスト; 省略された場合全てのファイルが選択される。 |
| includesfile | ファイルの名前; このファイルの各行が includes パターンとして扱われる。 ネストされた includefile 要素を使って一つ以上の選択ファイルを指定することができる。 |
| excludes | カンマあるいは空白で区切られた除外するファイルのパターンのリスト; 省略された場合、(デフォルト除外ファイルを除き)何も除外しない。 |
| excludesfile | ファイルの名前; このファイルの各行が excludes パターンとして扱われる | ネストされた excludefile 要素を使って一つ以上の除外ファイルを指定することができる。
include and excludeinclude と excludeEach such element defines a single pattern for files to include or exclude.
ここにあるそれぞれの要素はファイルを選択あるいは除外する一つのパターンを定義します。
| Attribute | Description | Required |
| name | the pattern to in/exclude. | Yes |
| if | Only use this pattern if the named property is set. | No |
| unless | Only use this pattern if the named property is not set. | No |
| 属性 | 説明 | 必須 |
| name | 選択/除外するパターン | Yes |
| if | 指定された名前のプロパティが設定された場合のみ、このパターンを使う | No |
| unless | 指定された名前のプロパティが設定されていない場合のみ、このパターンを使う | No |
includesfile and excludesfileincludesfile と excludesfileIf you want to list the files to include or exclude external to your build file, you should use the includesfile/excludesfile attributes or elements. Using the attribute, you can only specify a single file of each type, while the nested elements can be specified more than once - the nested elements also support if/unless attributes you can use to test the existance of a property.
自分のビルドファイルと別のファイルで、選択あるいは除外するファイルを列挙したい場合には、includesfile/excludesfile 属性または要素を使います。 この属性を使うことにより、 個々のタイプの一つのファイルだけを指定できます。 ネストした要素もまた if/unless 属性をサポートしているので、 あるプロパティが存在するかどうかテストできます。
| Attribute | Description | Required |
| name | the name of the file holding the patterns to in/exclude. | Yes |
| if | Only read this file if the named property is set. | No |
| unless | Only read this file if the named property is not set. | No |
| 属性 | 説明 | 必須 |
| name | 選択/除外するパターンが入ったファイル名 | Yes |
| if | 指定された名前のプロパティが設定された場合のみ、このファイルを読み込む | No |
| unless | 指定された名前のプロパティが設定されていない場合のみ、このファイルを読み込む | No |
patternsetPatternsets may be nested within one another, adding the nested patterns to the parent patternset.
親のパターンセットにネストされたパターンを加えることにより、 パターンセットは互いにネストすることあります。
<patternset id="non.test.sources" > <include name="**/*.java"/> <exclude name="**/*Test*"/> </patternset>
Builds a set of patterns that matches all .java files
that do not contain the text Test in their name. This set
can be referred to via
<patternset refid="non.test.sources"/>,
by tasks that support this feature, or by FileSets.
名前にTestを含まない
全ての.javaファイルにマッチするパターンの集合を生成します。
この集合は、
この機能をサポートするタスクやファイルセットにより
<patternset refid="non.test.sources"/>を使って
参照されます。
includes とexcludes
の属性はカンマか空白文字で区切られた複数の要素を受け付けるのに対し、
ネストされた <include> と <exclude>要素では、
name 属性が一つのパターンを保持することになっています。
The nested 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.
ネストされた要素では、 あるプロパティが設定された場合のみその要素を使うか、または、 あるプロパティが設定されていない場合のみその要素を使うか指定するために、 if と unless 属性が使えます。
For example
例えば example
<patternset id="sources" > <include name="std/**/*.java"/> <include name="prof/**/*.java" if="professional"/> <exclude name="**/*Test*"/> </patternset>
will only include the files in the sub-directory prof if the property professional is set to some value.
これは、プロパティprofessionalに何か値が設定された場合のみ、 サブディレクトリprofにあるファイルを選択します。
The two sets
次の 2 つの集合
<patternset includesfile="some-file" />
and
と
<patternset> <includesfile name="some-file" /> <patternset/>
are identical. The include patterns will be read from the file
some-file, one pattern per line.
は、同一のものです。選択パターンは、
一行毎に一パターンとしてファイルsome-fileにより読み込まれます。
<patternset>
<includesfile name="some-file" />
<includesfile name="${some-other-file}"
if="some-other-file"
/>
<patternset/>
will also read include patterns from the file the property
some-other-file points to, if a property of that name has
been defined.
これは、
some-other-fileという名前のプロパティが定義された場合、
プロパティsome-other-fileが示すファイルより選択パターンを読み込みます。
Copyright © 2000-2002 Apache Software Foundation. All rights Reserved.