ファイルのセットを任意のターゲット外のディレクトリにコピーする基本的なantスクリプトがあります。依存関係に関係なく、すべてのターゲットが実行された後にこれらのファイルをクリーンアップしたいと思います。私が持っている主な問題は、ターゲットが 'compile'または 'deploywar'になる可能性があるため、 'deploywar'が次に呼び出される可能性があるため、 'cleanUp'ターゲットを 'compile'から盲目的に呼び出すことはできません。そして、呼び出されない可能性があるので、私は盲目的に 'deploywar'から呼び出すことはできません。他のすべての必要なターゲットが完了した後に呼び出されるターゲットを定義するにはどうしたらいいですか?依存関係にかかわらず最終的なantターゲットを強制的に実行する方法
<project name="proto" basedir=".." default="deploywar">
...
<copy todir="${web.dir}/WEB-INF/lib">
<fileset dir="${web.dir}/WEB-INF/lib/common"/>
</copy>
<target name="compile">
<!-- Uses ${web.dir}/WEB-INF/lib -->
....
</target>
<target name="clean" description="Clean output directories">
<!-- Does not use ${web.dir}/WEB-INF/lib -->
....
</target>
<target name="deploywar" depends="compile">
<!-- Uses ${web.dir}/WEB-INF/lib -->
....
</target>
<target name="cleanUpLib">
<!-- Clean up temporary lib files. -->
<delete>
<fileset dir="${web.dir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
</delete>
</target>
動作しません。 -compileまたは-deploywarが例外で失敗した場合、cleanUpLibは決して実行されません。 – rreyes1979