我有問題測試文件存在與螞蟻。我想檢查目標文件是否存在test
,如果不存在,我想下載目標文件download
。但是download
目標將始終執行(如果文件存在或不存在)。任何人都可以顯示什麼是錯的?螞蟻資源存在檢查
<!-- Test lib files if exist -->
<target name="test">
<condition property="is.resource.exists" value="true" else="false">
<and>
<resourceexists>
<file file="${lib}/jdom-2.0.5.jar" />
</resourceexists>
<resourceexists>
<file file="${lib}/miglayout-4.0-swing.jar" />
</resourceexists>
</and>
</condition>
</target>
<!-- Download lib files if not exist -->
<target name="download" if="is.resource.exists" depends="test">
<exec dir="${lib}" executable="${lib}/get-libs.sh" />
</target>
這是否修復雅http://stackoverflow.com/a/520567/1083581 – happybuddha 2013-05-06 21:30:46
這一個講述多個文件:http://stackoverflow.com/questions/15698694/check-multiple-file-exists-or- not-using-ant – 2013-05-06 21:35:43