Hello Leo,
yes you can.
you have 3 possibilities :
- use a combination of Ant and Groovy, so that you script around ant
tasks and datatypes, but with the possibility of using all possible
procedural logic,
- the traditional ant way : you need to create special targets which set
properties using the condition task. Targets executed after the targets
containing the conditions can use the properties in their if attribute
note that the if and unless attributes of targets are only sensitive to
the presence/absence of properties, rather than to their value
your build looks like this
<target name="all"
depends="inputdata,checknumservers,oneserver,morethanoneserver">
</target>
<target name="inputdata">
<input message="Enter the number of Servers" addproperty="numservers"/>
</target>
<target name="checknumservers">
<condition property="oneserver">
<equals arg1="${numservers}" arg2="1"/>
</condition>
<!-- no standard condition checking greater than, you can write
custom conditions -->
<condition property="morethanoneserver">
<not>
<equals arg1="${numservers}" arg2="1"/>
<not/>
</condition>
</target>
<target name="oneserver" if="oneserver">
<!-- some action here -->
</target>
<target name="morethanoneserver" if="morethanoneserver">
<!-- some action here -->
</target>
- the third way is to use ant-contrib.
Regards,
Antoine
Leo wrote:
Hi,
Iam trying to write a Ant based installer. It basically will ask for input from the user and then based on that information does different things. Iam not sure how to check if certain property is something?
Ex:
<input message="Enter the number of Servers" addproperty="numservers"/>
...
Now I need to do different things depending on the value of numservers. Like
in programming languages, we do:
if (numservers == 1) {
.....
} else if (numservers > 1) {
....
}
Can we do something similar using Ant?
Thanks!
---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates
starting at 1¢/min.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]