ant target to run only based on condition [duplicate]
Possible Duplicate:
Ant task to check if a file exists?
<target name="buildjunit">
<mkdir dir="${BUILD_TEST_DIR}" />
<ant antfile="build.xml" dir="${app}\dcs" target="compile-junit" inheritAll="false">
<property name="BUILD" value="${COMP_BUILD}" />
<property name="VER" value="${PREVIOUS_VERSION}" />
<property name="build.local" value="true" />
<property name="CONFIG" value="${CONFIG_HOME}/ESW/ESWCONFIG/ITT" />
</ant>
</target>
I want to build ant target compile-junit only if some of the jar doesnt exist in perticulary directory, how can i do it? ie compile-junit target inside buidljunit should ru开发者_开发技巧n only when there is no jar file exist in the directory project/jarlocation/dcs.
Slight variation to the question I commented as similar. To run when it doesn't exist replace 'if' with 'unless':
<target name="check-abc">
<available file="abc.txt" property="abc.present"/>
</target>
<target name="do-unless-abc" depends="check-abc" unless="abc.present">
...
</target>
精彩评论