2012-03-09 7 views

risposta

14

Non ci sono variabili in form (nucleo), ma proprietà e attributi.
@ {foo} è la sintassi per accedere al valore di un attributo macrodef all'interno di un macrodef, vale a dire:

<project name="tryme"> 
<macrodef name="whatever"> 
    <attribute name="foo" default="bar"/> 
    <sequential> 
    <echo>foo => @{foo}</echo> 
    </sequential> 
</macrodef> 

<!-- testing 1, foo attribute not set, will use default value --> 
<whatever/> 

<!-- testing 2, set attribute foo to 'baz'--> 
<whatever foo="baz"/> 
</project> 

uscita:

[echo] foo => bar 
[echo] foo => baz 

Vedi Ant manual macrodef
Mentre $ {pippo} è la sintassi per accedere al valore di una proprietà:

<project name="demo"> 
<property name="foo" value="bar"/> 
<echo>$${foo} => ${foo}</echo> 
</project> 

uscita:

[echo] ${foo} => bar 

Vedi Ant manual property

+0

Mi hai battuto! :-) –

+0

Strike ;-) Saluti || Slàinte mhath – Rebse

Problemi correlati