ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Determining the value of a property
Date Mon, 04 Aug 2003 08:16:58 GMT
On Mon, 4 Aug 2003, Giles Parnell <g.parnell@eclipsegroup.com.au>
wrote:

> I'm trying to set a property based on the outcome of a condition.
> 
>    <target name="isJBossRunning">
>         <condition property="alreadyRunning" value="true">
>             <and>
>                 <socket server="${webhost}" port="${webport}"/>
>                 <http
> url="http://${webhost}:${webport}/jmx-console/index.jsp"/>
>             </and>        
>         </condition>
>         <echo>Is jboss running on ${webhost}:${webport}? -
> ${alreadyRunning}</echo>        
>     </target>
> 
> However, i'm not sure of how to structure the system to obtain the
> value of alreadyRunning. At present this doesn't work?

Doesn't look wrong, so I guess that your server isn't running "At
present" and thus your property doesn't get set at all.

Put a <property name="alreadyRunning" value="false"/> between
<condition> and <echo>.  If the condition evaluates to true, your
property will have a value and the <property> task will have no effect
(properties are immutable).  If it doesn't, <condition> will not set
it and <property> provides the default value.

Stefan

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


Mime
View raw message