This example is quite similar to what you want to do. It offers the user a
choice of where to upload some files; the user can choose server Alpha as
the target of the upload, or server Beta, or both.
The upload target depends on the getserver task so the getserver task
executes first. The getserver task asks the user which target(s) the user
wants and sets the value of the property 'servername' accordingly. Then,
the antcall task within the upload target executes the appropriate target:
upload-Alpha, upload-Beta, or upload-Both. To keep the example simple, the
upload-Alpha and upload-Beta targets only display a short message to prove
that they have been invoked but you could have many complex tasks within
each of those targets. The upload-Both target is even simpler; it uses a
depends parameter to invoke upload-Alpha and upload-Beta.
--------------------------------------------------------------------------------------------------
<?xml version="1.0" ?><project name="Foo" default="upload" basedir=".">
<description>Let the user choose one or more options from a list.
</description>
<!--==================================================================
Determine which server is the target.
==================================================================-->
<target name="getserver" description="Determine which server is the target">
<input message="Which server should receive the files? 1. Alpha 2. Beta 3.
Both"
validargs="1,2,3"
addproperty="server.choice"
defaultvalue="2"/>
<condition property="servername" value="Alpha">
<equals arg1="${server.choice}" arg2="1"/>
</condition>
<condition property="servername" value="Beta">
<equals arg1="${server.choice}" arg2="2"/>
</condition>
<condition property="servername" value="Both">
<equals arg1="${server.choice}" arg2="3"/>
</condition>
</target>
<!--==================================================================
Execute the appropriate upload target, depending on which server
was chosen.
==================================================================-->
<target name="upload" depends="getserver" description="Upload to the
selected server.">
<antcall target="upload-${servername}"/>
</target>
<!--==================================================================
Upload to the Alpha server.
==================================================================-->
<target name="upload-Alpha" description="Upload to the Alpha server.">
<echo message="Uploading to Alpha...."/>
</target>
<!--==================================================================
Upload to the Beta server.
==================================================================-->
<target name="upload-Beta" description="Upload to the Beta server.">
<echo message="Uploading to Beta...."/>
</target>
<!--==================================================================
Upload to both servers.
==================================================================-->
<target name="upload-Both" depends="upload-Alpha,upload-Beta"
description="Upload to both servers.">
</target>
</project>
--------------------------------------------------------------------------------------------------
--
Rhino
----- Original Message -----
From: "Shweta Bodade" <[EMAIL PROTECTED]>
To: "Ant Users List" <user@ant.apache.org>
Sent: Tuesday, March 07, 2006 7:08 AM
Subject: And I want to input two args at a time through console
Can I have multiple choices for deploying target
I mean if an input message is given on selecting between three choices
and I want to execute two of them one after the other
How can I do that
For eg
<input message=-"Select between 1. TOMCAT 2. WEBSPHERE 3.WEBLOGIC"
Validargs="1,2,3">
And I want to input two args at a time through console
Can you hlep me with some examples.
--------------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.2.1/279 - Release Date: 10/03/2006
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.2.1/279 - Release Date: 10/03/2006
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]