ant でファイルの存在をテストする際に問題があります。target にファイルが存在するかどうかを確認し、存在しtest
ない場合は target にファイルをダウンロードします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>