ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: test if exists
Date Thu, 09 Jul 2009 07:54:13 GMT
>ant -Dpropname=xxx // correct usage
>ant // incorrect usage of my build
>
>Can I test a property existence?
>
>if propname not exists (
>   echo "Give more command line arg"
>   exit ant running
>)


You could check that with the <isset> condition.
In that case you would combine it with fail:

<fail>
  Give more command line arg
  <condition>
    <isset property="propname"/>
  </condition>
</fail>

If you can work with default values you can easily set that:
  <property name="propname" value="defaultvalue"/>

Because Ant properties are immutable (once set they cant be changed)
Ant will use the user value (from the command line) if given, otherwise
the default.


For an introduction have a look at the tutorial
http://ant.apache.org/manual/tutorial-HelloWorldWithAnt.html


Jan


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message