Hello,

in old days I wrote a target which checks for the file, and then call this target with antcall for single or ant-contrib:foreach for lists of files. Example with the normal path (customize to your needs):

<target name="check.fileonpath">
    <fail unless="file" message="${file}"/>
    <property environment="env"/>
    <condition property="path" value="${env.PATH}">
        <isset property="env.PATH"/>
    </condition>
    <condition property="path" value="${env.Path}">
        <isset property="env.Path"/>
    </condition>

<fail unless="path" message="Failure: PATH/Path not found while looking for ${file}"/>

<available property="present" file="${file}" type="file" filepath="${path}"/>

<fail unless="present" message="Failure: File ${file} not found in PATH"/>
    <echo message="Checked: ${file} found in PATH"/>
</target>

Than call this e.g. with antcall:

<antcall target="check.fileonpath">
        <param name="file" value="cl.exe"/>
</antcall>

or

<foreach target="check.fileonpath" list="..." param="file"/>

Cheers,
André

Lars Ræder Clausen schrieb:
I use Ant to compile a Java module that depends on a number of jar
files that cannot be built from within the same build file.  I have
them all listed in a class path, but I'd like to have a precondition
that fails if any of the jars listed do not exists -- makes the error
much easier to understand. After perusing the Ant manual, I haven't
seen anything that can do this.  The Available task only checks one
file at a time, so I'd have to list all the files again. If it truly
doesn't exist, I guess I'll have to build it myself, but it seems too
basic to not exist. What obvious task/combination of conditions am I
missing?

Thanks,
-Lars

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to