ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject RE: txtfile with various lines
Date Thu, 09 Dec 2004 16:25:43 GMT

Hi, thanks Jan, didn't realise at first glance that unset properties 
are echoed as -> ${unset.property}

Solved it like that :

<loadfile srcfile=".\${temp.deploy}/bla.txt" property="infomail.servrestart">
    <filterchain>
        <linecontainsregexp>
            <regexp pattern="^CAUTION"/>
        </linecontainsregexp>
    </filterchain>  
</loadfile>


(The property -if set- has to appear in a messagefile that is sent via mail)

<target name="servrestart" if="infomail.servrestart">
    <echo file = ".\${temp.deploy}/infomail.txt" append="true">
    "!!! ${infomail.servrestart} !!!"
    </echo>
</target>

Thanks to list for input !!

Gilbert

-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
Sent: Thursday, December 09, 2004 3:26 PM
To: user@ant.apache.org
Subject: AW: txtfile with various lines


> in other words
> <echo message=${servrestart}/>

Sorry that is invalid - invalid xml. Attribute values have to be quoted.

<echo message="${servrestart}"/>

Then the Ant runtime would search for a property servrestart and evaluates
that to its value or - if not set - to ${servrestart}. So you´ll get
a) with value=Hello World
   [echo] Hello World
b) not set
   [echo] ${servrestart}

Back to the original thread: what you can do with unset properties is

<target name="server.check">
    <loadfile property="servrestart"> ...
</target>
<target name="server" depends="server.check" if="servrestart">
    <echo>Property set. Server has to be restarted.</echo>
</target>


Jan

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


Mime
View raw message