<fail message="@{propertyName} is not set">
<condition>
<not>
<isset property="@{propertyValue}" />
</not>
</condition>
</fail>
To test a range of properties, use this code snippet to create a macro:
<macrodef name="testProperty">
<attribute name="propertyName" />
<attribute name="propertyValue" />
<sequential>
<fail message="@{propertyName} is not set">
<condition>
<not>
<isset property="@{propertyValue}" />
</not>
</condition>
</fail>
</sequential>
</macrodef>
then simply call this macro with each value you want to test
<testProperty propertyName="property1" propertyValue="${property1}" />
<testProperty propertyName="property2" propertyValue="${property2}" />
<testProperty propertyName="property3" propertyValue="${property3}" />
<testProperty propertyName="property4" propertyValue="${property4}" />
<testProperty propertyName="property5" propertyValue="${property5}" />
No comments:
Post a Comment