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: how to check that a property exist
Date Thu, 12 Jun 2008 12:15:31 GMT
 

-----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


Mime
View raw message