Antversion

自 Ant 1.7.0 起

說明

儲存 Apache Ant 版本(當用於任務時)或檢查特定 Ant 版本(當用於條件時)。

屬性 說明 必要
任務 條件
atleast 此 Ant 至少為的版本。格式為 major.minor.point 這些屬性中必須有一個
exactly 此 Ant 確切為的版本。格式為 major.minor.point
property 要設定的屬性名稱。 略過

範例

將目前的 Ant 版本儲存在屬性 antversion 中。

<antversion property="antversion"/>

如果目前的 Ant 版本為 1.6.0 或更高,則將 Ant 版本儲存在屬性 antversion 中。否則不會設定該屬性。

<antversion property="antversion" atleast="1.6"/>

如果執行的是 Ant 1.7.0,則設定屬性 ant-is-exact-7。1.6.5 和 1.7.1 都不會符合。

<antversion property="ant-is-exact-7" exactly="1.7.0"/>

如果執行的是 Ant 1.7.0,且可以從 Ant 首頁取得非錯誤回應,則設定 Ant17isOnline

<condition property="Ant17isOnline">
  <and>
    <antversion exactly="1.7.0"/>
    <http url="https://ant.dev.org.tw"/>
  </and>
</condition>