You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "P.N." <pe...@gmx.de> on 2011/01/03 11:58:40 UTC
[antxtras] Cannot echo variable
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
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: [antxtras] Cannot echo variable
Posted by "P.N." <pe...@gmx.de>.
Hi Sourabh,
this doesn't work, either, because it's not valid XML syntax. Trying to
use it results in an error message:
Element type "echo" must be followed by either attribute specifications,
">" or "/>".
Thanks
Peter
sourabh chaki schrieb:
> Hi Peter,
>
> Here message is a string of value "TEST = ${$var:test}" as it is quoted.
> <echo message="TEST = ${$var:test}"/>
>
> Variable part should be unquoted.
>
>
> Try this.
>
>
> <xtras:assign var="test" value="dummy"/>
> <echo message="TEST = "+${$var:test}/>
>
> Thanks
> Sourabh
>
>
> On Mon, Jan 3, 2011 at 4:28 PM, P.N.<pe...@gmx.de> wrote:
>>
>> 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
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: [antxtras] Cannot echo variable
Posted by sourabh chaki <ch...@gmail.com>.
Hi Peter,
Here message is a string of value "TEST = ${$var:test}" as it is quoted.
<echo message="TEST = ${$var:test}"/>
Variable part should be unquoted.
Try this.
<xtras:assign var="test" value="dummy"/>
<echo message="TEST = "+${$var:test}/>
Thanks
Sourabh
On Mon, Jan 3, 2011 at 4:28 PM, P.N. <pe...@gmx.de> wrote:
>
> 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: [antxtras] Cannot echo variable
Posted by Wascally Wabbit <wa...@earthling.net>.
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]
Re: [antxtras] Cannot echo variable
Posted by "P.N." <pe...@gmx.de>.
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
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org