It may be useful to be able to stop the build only if a property is not
set. Here is a patch for the built-in task fail. Another possibility to
do that is to have a target with the attribute "if" which will
containing the fail task:
<target name="test" if="prop.I.want">
    <fail message="Set the prop.I.want !">
</target>
But it is not nice to add a target for each property you want to check.
With the patch you just add a line:
<fail message="Set the prop.I.want !" unless="prop.I.want">

Is there any other possibility to do that?

-- 
Iulian Musat 
3DGeo Development Inc.
465 Fairchild Drive, Suite 226, Mountain View, CA 94043
Tel: 650-969-3886 x107, Fax: 650-969-6422
Index: src/main/org/apache/tools/ant/taskdefs/Exit.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Exit.java,v
retrieving revision 1.3
diff -u -r1.3 Exit.java
--- src/main/org/apache/tools/ant/taskdefs/Exit.java    2001/03/29 10:21:12     
1.3
+++ src/main/org/apache/tools/ant/taskdefs/Exit.java    2001/05/30 23:19:40
@@ -69,7 +69,16 @@
         this.message = value;
     }
     
+    private String testProp;
+
+    public void setUnless(String value) { 
+        this.testProp = value;
+    }
+    
     public void execute() throws BuildException {
+       if(testProp != null && getProject().getProperty(testProp) != null)
+           return;
+
         if (message != null && message.length() > 0) { 
             throw new BuildException(message);
         } else {

Reply via email to