I created a macro to search for a file in a number of directories. That part is working.
Now I'm trying to add fail to the macro if no file is found but this gives me an error
macrodef doesn't support the nested "fail" element.
Is there a way to achieve this ?
<macrodef name="searchfile">
<attribute name="file" />
<attribute name="path" default="${custom.buildconfig},${wst.basedir}" />
<attribute name="name" />
<attribute name="verbose" default="false" />
<sequential>
<first id="@{name}">
<multirootfileset basedirs="@{path}" includes="@{file}" erroronmissingdir="false" />
</first>
<property name="@{name}" value="${toString:@{name}}" />
<echo>property @{name} ${@{name}}</echo>
</sequential>
<fail message="${file}was not found in ${custom.buildconfig},${wst.basedir}">
<condition>
<equals arg1="${@{name}" arg2=""/>
</condition>
</fail>
</macrodef>
Credits to martin clayton for his comment, moving fail in the sequential fixes the issue.