ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ric Searle <>
Subject 'default' option for Input task
Date Fri, 28 Jun 2002 12:05:37 GMT

I'd like some help achieving what I believe should be a very simple task 
in Ant (1.5).

I want the build script to ask the user for a 'hostname' parameter, and 
I'd like the default answer to be whatever the system's HOSTNAME 
environment variable is set to.  I think I'm nearly there with the code 
below, but the <equals> condition doesn't behave as I'd expect.  The 
finalHostName property is never set to env.HOSTNAME.

         <property environment="env"/>

         <input message="What hostname should I use? [${env.HOSTNAME}]" 
         <condition property="finalHostName" value="${env.HOSTNAME}">
             <equals arg1="${input.hostname}" arg2="" trim="yes"/>

         <!-- This will be ignored (hopefully) if a custom hostname has 
been entered -->
         <property name="finalHostname" value="${input.hostname}"/>

         <echo message="Hostname is set to: ${finalHostname}"/>

Any help would be greatly appreciated.  I would like to see a 'default' 
option added to the Input task - does anyone else think that this is a 
sensible suggestion?


   Ric Searle
   Web Application Developer
   Dialogue Communications Ltd
   +44 (0) 114 221 0307

The Workstation, 15 Paternoster Row, Sheffield, S1 2BX, United Kingdom.

Dialogue Communications (Estd. 1994) is a world leader in the development
and implementation of mobile data and internet messaging solutions.
The company's technology bridges the gap between the fixed and mobile
worlds - delivering carrier class platforms to both service providers and
enterprise customers around the globe.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message