PropertySet

自 Apache Ant 1.6 起

將一組屬性分組,供支援此組屬性的任務使用。

屬性 說明 必要
dynamic 每次使用此組屬性時,是否重新評估此組屬性。 否;預設為 true
negate 是否否定結果。如果為 true,則會傳回未由巢狀元素選取的所有屬性。自 Ant 1.6.2 起 否;預設為 false
refid 讓此 propertyset 成為對其他地方定義的 propertyset參考。如果指定,則不允許其他屬性或巢狀元素。

指定為巢狀元素的參數

propertyref

從目前的專案中選取要包含在此組屬性中的屬性。

屬性 說明 必要
name 選取具有指定名稱的屬性。 其中一個
prefix 選取名稱以指定字串開頭的屬性。
regex 選取符合指定正規表示法的屬性。類似於 正規表示法類型對應器,這需要支援的正規表示法函式庫。
builtin 選取內建的屬性組。此屬性的有效值包括 all(表示所有 Ant 屬性)、system(表示系統屬性)和 commandline(表示呼叫 Ant 時在命令列中指定的屬性,以及許多特殊的內部 Ant 屬性)。

propertyset

propertyset 可用作更多 propertyset 的集合聯集。

例如

<propertyset id="properties-starting-with-foo">
  <propertyref prefix="foo"/>
</propertyset>
<propertyset id="properties-starting-with-bar">
  <propertyref prefix="bar"/>
</propertyset>
<propertyset id="my-set">
  <propertyset refid="properties-starting-with-foo"/>
  <propertyset refid="properties-starting-with-bar"/>
</propertyset>

會將名稱以 foobar 開頭的所有屬性收集到名為 my-set 的組屬性中。

mapper

一個 對應器,最多可以指定一個對應器。對應器用於變更屬性金鑰的名稱,例如

<propertyset id="properties-starting-with-foo">
  <propertyref prefix="foo"/>
  <mapper type="glob" from="foo*" to="bar*"/>
</propertyset>

會收集所有名稱以 foo 開頭的屬性,但將名稱變更為以 bar 開頭。

如果提供,則會在否定任何匹配的屬性之後套用巢狀對應器。