1

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 run only when there is no jar file exist in the directory project/jarlocation/dcs.

Community
  • 1
  • 1
TechFind
  • 3,696
  • 18
  • 47
  • 62
  • This looks like the answer http://stackoverflow.com/questions/520546/ant-task-to-check-if-a-file-exists – Matt Bond Jun 14 '11 at 10:22

1 Answers1

2

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> 
Community
  • 1
  • 1
Matt Bond
  • 1,402
  • 12
  • 19