ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Schmitt" <sschm...@raleigh.ibm.com>
Subject Re: check of properties
Date Tue, 12 Dec 2000 12:25:14 GMT
Hi

use the if/unless attribute of  <target> so you can create two targets where
one is accessed if the property is set and the other is accessed if the
property is not set. Like the following hack

<project name="Hugo" default="param_available" basedir=".">
    <target name="param_available" if="param" depends="param_notavailable">
        <echo message="param set value=${param}"/>
    </target>
    <target name="param_notavailable" unless="param">
        <echo message="param notset"/>
    </target>
</project>

This xml syntax should make the following output
if param is set -> param set value=  xxx
and if not -> param is not set

Yours
Stefan S
----- Original Message -----
From: "Marco Struck" <M.Struck@PopNet.de>
To: <ant-user@jakarta.apache.org>
Sent: Tuesday, December 12, 2000 9:08 AM
Subject: check of properties


> hi folk,
>
> i would like to ensure that a property has been set - what is the rigtht
way
> ?
>
> <!-- call with: ant param -Dparam=test -->
> <target name="param">
> <!-- ensuring that param has been set -->
> <echo message="param=${param}" />
> </target>
>
>


Mime
View raw message