檢查延伸模組是否出現在 fileset
或 extensionSet
中。如果延伸模組存在,則會設定一個屬性。
請注意,此任務會使用「選用套件」規格所定義的延伸模組。如需瞭解選用套件的詳細資訊,請參閱 Java Standard Edition 套件文件組合中檔案 guide/extensions/versioning.html 中的「選用套件版本控制」文件,或參閱線上 延伸模組與延伸模組組文件。
屬性 | 說明 | 必要 |
---|---|---|
property | 如果延伸模組可用,則設定屬性的名稱 | 是 |
file | 要檢查延伸模組的檔案 | 是,除非指定巢狀的 <extensionSet> 或 <fileset> |
Extension 要搜尋的延伸模組。
FileSet 用於選取要檢查延伸模組的檔案組。
ExtensionSet 是要搜尋延伸模組的延伸模組組。
在單一檔案中搜尋延伸模組
<jarlib-available property="myext.present" file="myfile.jar"> <extension extensionName="org.apache.tools.ant" specificationVersion="1.4.9" specificationVendor="Apache Software Foundation"/> </jarlib-available>
在單一檔案中搜尋延伸模組,並參照外部 Extension
<extension id="myext" extensionName="org.apache.tools.ant" specificationVersion="1.4.9" specificationVendor="Apache Software Foundation"/> <jarlib-available property="myext.present" file="myfile.jar"> <extension refid="myext"/> </jarlib-available>
在 fileset 中搜尋延伸模組
<extension id="myext" extensionName="org.apache.tools.ant" specificationVersion="1.4.9" specificationVendor="Apache Software Foundation"/> <jarlib-available property="myext.present"> <extension refid="myext"/> <fileset dir="lib"> <include name="*.jar"/> </fileset> </jarlib-available>
在 extensionSet 中搜尋延伸模組
<extension id="myext" extensionName="org.apache.tools.ant" specificationVersion="1.4.9" specificationVendor="Apache Software Foundation"/> <jarlib-available property="myext.present"> <extension refid="myext"/> <extensionSet id="exts3"> <libfileset includeUrl="false" includeImpl="true" dir="lib"> <include name="*.jar"/> </libfileset> </extensionSet> </jarlib-available>