All,
Can someone please help on how to include a directory in a path element conditionally if the directory exists: So like below
<path id="lib.path.ref">
<fileset dir="${lib.dir}" includes="*.jar"/>
<path location="${build.dir}" if="${build.dir.exist}" />
</path>
This currently does not work because path element does not support the if attribute. In my case, I want to include build.dir if only it exists.
Thanks
Without installing Ant-Contrib or similar Ant extensions, you can accomplish what you want with the following XML:
The important part here is what happens in the
-inittarget. It depends upon the-set-path-with-build-dirand-set-path-without-build-dirtargets, but Ant only executes one target based upon whetherbuild.dir.existsis set or not.Read more about the Available Task here: http://ant.apache.org/manual/Tasks/available.html.