ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: MacroDef, Script, MD.Attribute
Date Fri, 17 Oct 2003 12:18:24 GMT
Aha, so I should do a
    <script>
        foo = "${foo}";
    </script>
on the beginning and all should work :-)

I´ll try that later.
Thanks


Jan


> -----Original Message-----
> From: peter reilly [mailto:peter.reilly@corvil.com]
> Sent: Friday, October 17, 2003 2:05 PM
> To: Ant Users List
> Subject: Re: MacroDef, Script, MD.Attribute
> 
> 
> Good point,
> 
> <script> does not do replace properties on
> the contained text but macrodef does on
> all contained text so the following works:
> 
>   <macrodef name="hello">
>     <attribute name="x"/>
>     <sequential>
>       <script language="beanshell">
>         System.out.println("Hello world ${x}");
>       </script>
>     </sequential>
>   </macrodef>
>   <hello x="this is x"/>
> 
> Another way would be to use <variable> from
> antelope, and now in ant-contrib to
> override the value each time. (Does not
> work too good with <parallel/>)
> 
> Peter
> 
> On Friday 17 October 2003 12:53, Jan.Materne@rzf.fin-nrw.de wrote:
> > How can I access macrodef attributes from inside a script?
> >
> > <macrodef>
> >     <attribute name="foo"/>
> >     <sequential>
> >         <script language="javascript"> <![CDATA[
> >
> >             // how to access the value of 'foo' ??
> >
> >         ]]></script>
> >     </sequential>
> > </macrodef>
> >
> >
> > Because <attribute>s are not <property>s, I can´t use
> > project.getProperty("foo"). And setting a
> >     <property name="fooValue" value="${foo}"/>
> > will work only on first time, because properties are
> > immutable.
> >
> >
> > Jan
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message