Hi Peter,
Not sure why your original snippet did not work; it should.
You're declaring a variable -- so you should use $var:
not $ref: (variables and references are distinct).
To define a string as a reference, use the scope='project'
attribute of the <assign/> component as in:
<oja:assign var="arefid" value="Hello" scope="project"/>
<echo message="MYID: ${$ref:myrefid}"/>
I've attached an example snippet file that shows both uses
(run it from $ANTXTRAS_HOME/etc using 'ant -f assign-example.xml')
HTH,
The Wabbit
P.N. wrote:
Found my problem: had to use $ref: instead of $var:
Regards
P.
P.N. schrieb:
Hello!
I've got a problem with variables in the following snippet:
<xtras:assign var="test" value="dummy"/>
<echo message="TEST = ${$var:test}"/>
Results in:
[echo] TEST = ${$var:test}
Seems, the reference to the variable is incorrect.
Using antxtras_3.0.0b1-build1083.45 and ant-1.8.1.
What's wrong???
Kind regards
Peter
[snip]
<?xml version="1.0"?>
<project name="assign-sample" basedir="." default="echo"
xmlns:oja="jwaresoftware.antxtras">
<!--
|| Locate the AntXtras distro under test...
-->
<dirname property="root.d" file="${basedir}"/>
<!--
|| Now do the actual test...
-->
<target name="echo">
<taskdef onerror="failall"
uri="jwaresoftware.antxtras"
resource="org/jwaresoftware/antxtras/install/antlib.xml">
<classpath>
<fileset dir="${root.d}/lib">
<include name="*.jar"/>
</fileset>
</classpath>
</taskdef>
<oja:assign var="myvarid" value="dummy"/>
<echo message="MY VAR = ${$var:myvarid}"/>
<oja:assign var="myrefid" value="DUMMY" scope="project"/>
<echo message="MY REF = ${$ref:myrefid}"/>
</target>
</project>
<!-- $Id:$ -->
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org