[ant-contrib - Help] Syntax used for nested var values???
"SourceForge.net" <[email protected]> Wed, 31 Oct 2007 06:59:30 -0700
| Newsgroups | gmane.comp.java.ant-contrib.devel |
|---|---|
| Message-ID | <[email protected]> |
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=4598222
By: hrauch
Hi to all ant-contrib forum members,
I'm currently struggling with the problem of how to access nested var values.
More precisely, I'm talking about my try to use something like @{@{othervar}}
to do so, which is not quite right (see also XML comment in the Ant build file
below).
Any help is greatly appreciated. Thanks in advance for any help/links, etc.
:-)))
Kind regards,
Holger
==================================================================
<?xml version="1.0" encoding="iso-8859-1" ?>
<project name="nestedvartest" default="do" basedir=".">
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<macrodef name="varnamevalinmac">
<attribute name="samplevar" default="NOT SET" />
<attribute name="othervar" default="NOT SET" />
<sequential>
<var name="@{samplevar}" unset="true" />
<echo message="before for loop: othervar contains @{othervar}" />
<for list="a,b,c,d,e"
param="othervarval">
<sequential>
<var name="@{othervar}" value="@{othervarval}" />
<echo message="inside for loop: @{othervar} contains @{othervarval}" />
<if>
<not>
<isset property="@{samplevar}" />
</not>
<then>
<!-- What's the right syntax for accessing @{othervar}'s value after
it has been assigned, I mean *without* using the for loop param's value??? -->
<var name="@{samplevar}" value="@{@{othervar}}" />
<echo message="@{samplevar} previously NOT set; initially contains
${@{samplevar}}" />
</then>
<else>
<var name="@{samplevar}" value="${@{samplevar}} @{@{othervar}}" />
</else>
</if>
</sequential>
</for>
<!-- Analogous for @{samplevar}'s value -->
<echo message="@{samplevar} contains @{@{samplevar}}" />
</sequential>
</macrodef>
<target name="do">
<varnamevalinmac samplevar="test"
othervar="test2" />
</target>
</project>
===========================================================================
______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=113701
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/