2

Requirement : to check if the file is available or not and then based on true or false value perform some task.

I am using task:

<varNested name="path" value="/user1/abc.jar"/>
<available file="${path}" property="file.available"/>

Problem 1: Now when I am trying to print this property:

<echo message="value of file is available is : ${file.available}"/>

rather than printing the value true it prints ${file.available}

Problem 2: Will this code snippet work? if not, what shall be used instead of equalsNested? ...

        </then>
        <else>
           ...
        </else>
        </if>
Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
user1731553
  • 1,887
  • 5
  • 22
  • 33
  • possible duplicate of [Ant task to run an Ant target only if a file exists?](http://stackoverflow.com/questions/520546/ant-task-to-run-an-ant-target-only-if-a-file-exists) – Mark O'Connor Sep 14 '14 at 21:31

1 Answers1

0

Try this:

<property name="abc" value="false" />
<available file="somefile" property="abc" value="true"/>
<echo message="value of file is available is : ${abc}"/>
Peter Pei Guo
  • 7,770
  • 18
  • 35
  • 54
  • Thanks for the Guidance... With the code above, it complains that I am trying to set the value of the same property 2 time. but this works: ` ` – user1731553 Sep 15 '14 at 11:43