Embedding and Extending Apache Ant – testing properties

If you want to test a property from a custom task in Apache Ant 1.8, you can use the testUnlessCondition and testIfCondition in org.apache.tools.ant.PropertyHelper:

@Override
public void execute() throws BuildException
{
   final PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(getProject());
   if(propertyHelper.testUnlessCondition(requiredPropertyName))
   {
      // property is missing
   }
}

Leave a Reply

Your email address will not be published. Required fields are marked *