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: Dereferencing property files
Date Fri, 04 Dec 2009 08:19:03 GMT
 

-----Original Message-----
From: Dalton, Tom [mailto:tdalton@hp.com] 
Sent: Thursday, December 03, 2009 5:38 PM
To: Ant Users List
Subject: RE: Dereferencing property files

/*
Jan,

Thanks - that is exactly what I need... I'm sorry I did not see that sooner!

Is there any chance of this propertycopy-by-macro being turned into a core task in the future?
I am surprised no one has done this...

Cheers

Tom
*/

there might be other solutions with (already existing) non core ant tasks, see =

1. AntXtras
http://marc.info/?l=ant-user&m=125570159119806&w=2

2. AntContrib
http://marc.info/?l=ant-user&m=121318477419672&w=2

2. Antelope
http://antelope.tigris.org/

the example 2. with Antelope which i prefer now over Antcontrib,
is slightly different and somewhat shorter =

<project name="bla" default="main" basedir=".">

<!-- Import Antelope task suite -->
<taskdef resource="ise/antelope/tasks/antlib.xml" />

<!-- // Properties -->
<property name="IPEvent" value="other"/>

<property name="defaultPollerManagedServer" value="A"/>
<property name="TestEvent.pollerManagedServer" value="B"/>
<property name="DummyEvent.pollerManagedServer" value="C"/>
<!-- Properties // -->

<!-- Antelope -->
<target name="depends">
  <if name="${IPEvent}.pollerManagedServer" exists="true">
      <var name="pollerEventValue"
           value="$${${IPEvent}.pollerManagedServer}"
      />
    <else>
      <property name="pollerEventValue"
                value="${defaultPollerManagedServer}"
      />
    </else>
  </if>
</target>

<!-- AntContrib
  <target name="depends">
    <if>
      <isset property="${IPEvent}.pollerManagedServer" />
      <then>
        <var name="pollerEventValue"
             value="$${${IPEvent}.pollerManagedServer}"
        />
      </then>
      <else>
        <property name="pollerEventValue"
                  value="${defaultPollerManagedServer}"
        />
      </else>
    </if>
  </target>
-->

<target name="main" depends="depends">
  <echo>$${pollerEventValue} == ${pollerEventValue}</echo>
</target>



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