ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Patrizio.Ferl...@b-source.ch>
Subject RE: how to check that a property exist
Date Thu, 12 Jun 2008 14:56:00 GMT

Thanks again !!!

I'm looking at your last hint:

<script>
check your existing properties etc. ...
set new properties you need for further processing via use of ant api
<script/>

but I don't know how to use it.
My ant version is: Apache Ant version 1.6.5 compiled on June 2 2005 and
I read that script task depends on external libraries not included in
the Ant distribution.

So I choose the "lowlevel" approach:

<echo file="tmp.properties">pollerValue=${pollerValue}</echo>

The properties file is created:

/tmp> cat tmp.properties 
pollerValue=bnk01alm01

but then

<property name="pollerValue"   value="${pollerValue}"
file="tmp.properties"/>

doesn't work. I'm trying to understand why ...

Regards
Patrizio


-----Original Message-----
From: Patrizio.Ferlito@b-source.ch [mailto:Patrizio.Ferlito@b-source.ch]

Sent: Thursday, June 12, 2008 1:42 PM
To: user@ant.apache.org
Subject: RE: how to check that a property exist

/*
Hi Gilbert,

issue ii) solved using macrodef:

  <target name="pollerEventIsSet-if" depends="check-pollerEventIsSet"
if="pollerEventIsSet">
    <macrodef name="propertycopy">
      <attribute name="pollerEvent"/>
        <sequential>
          <property name="pollerValue" value="${@{pollerEvent}}"/>
        </sequential>
    </macrodef>
    <propertycopy pollerEvent="${IPEvent}.pollerManagedServer"/>
    <echo>pollerEventIsSet, pollerValue: ${pollerValue}</echo>
  </target>

output:

pollerEventIsSet-if:
     [echo] pollerEventIsSet, pollerValue: bnk01alm01


Any idea about issue i) ?

*/

issue ii) =
i believe that's solution which is also listed in the ant faq
as far as i remember

issue i)
the problem is you're using antcall which opens a new project scope
means after antcall is through the project scope is gone and you
don't get back anything to the calling target.

therefore tasks like AntCallBack, AntFetch exist in antcontrib ;-)

possible solutions =

very lowlevel = echo value to a file and load it in the calling target

/*
thanks a lot for your hint but I would like to find a way without using
antcontrib...
*/
go with antcontrib - i see you're already using it, as propertycopy
is part of the antcontrib task suite ;-)))  and adapt my snippet to your
needs

or finally - recommended -  use
<script>
check your existing properties etc. ...
set new properties you need for further processing via use of ant api
<script/>

Regards, Gilbert

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


IMPORTANT: 
This e-mail transmission is intended for the named 
addressee(s)only. 
Its contents are private, confidential and protected 
from disclosure and should not be read, copied or
disclosed by any other person. 
If you are not the intended recipient, we kindly ask
you to notify the sender immediately by telephone 
(+41 (0)58 806 50 00), to redirect the message to the 
account "info@b-source.ch" and to delete this e-mail.
E-mail transmissions may be intercepted, altered or 
read by unauthorized persons and may contain viruses.
Therefore, it is recommended that you use regular mail
or courier services for any information intended to be 
confidential. However, by sending us messages through
e-mail, you authorize and instruct us to correspond by 
e-mail in the relevant matter. 
Thank you.


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


Mime
View raw message