ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knuplesch, Juergen" <Juergen.Knuple...@icongmbh.de>
Subject AW: Checking for build.properties and properties upon initialization
Date Wed, 21 May 2008 15:01:30 GMT
Use the <if> task from antcontrib, which makes things easier.  


-- 
Jürgen Knuplesch                    www.icongmbh.de
icon Systemhaus GmbH                Tel. +49 711 806098-275
Sophienstraße 40                    
D-70178 Stuttgart                   Fax. +49 711 806098-299

Geschäftsführer: Uwe Seltmann
HRB Stuttgart 17655
USt-IdNr.: DE 811944121 
-----Ursprüngliche Nachricht-----
Von: Dimitris Mouchritsas [mailto:dimitris.mouchritsas@eurodyn.com] 
Gesendet: Mittwoch, 21. Mai 2008 16:37
An: Ant Users List
Betreff: Re: Checking for build.properties and properties upon initialization

Dimitris Mouchritsas wrote:
> Hi everyone.
> I'm trying to create a sample project to test if the build.properties 
> file exists and if the required properties are set upon 
> initialization. But I'm not quite sure if I use correctly the 
> condition task. This is what I've come up with right now:
>
> <?xml version="1.0" encoding="utf-8"?> <project name="TestProject" 
> default="init">
>
>    <target name="check-required-properties"
>            description="Checks for required properties">
>
>        <fail>
>            <condition>
>                <and>
>                    <available file="build.properties" />
>                    <isset property="server.path" />
>                </and>
>            </condition>
>        </fail>
>
>    </target>
>
>    <target name="init"
>            description="Check build properties and initialize 
> directory structure"
>            depends="check-required-properties">
>        <tstamp />
>    </target>
> </project>
>
> Without the build.properties file the build process succeeds. Why?
> Thanks
> Dimitris
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional 
> commands, e-mail: user-help@ant.apache.org
>
Hmm, ok I managed to sold this once I understood that fails needs a "true" condition and my
condition was failing ofcourse. So I changed it to:
<condition>
    <not>
        <and>
            <available file="build.properties" />
            <isset property="server.path" />
        </and>
    </not>
</condition>

Now I'd like to ask another question. Would it be possible to know which property is not set,
so I can print it?
Thanks
Dimitris


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


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


Mime
View raw message