You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Glebow, Philip BGI SF" <Ph...@barclaysglobal.com> on 2004/01/24 03:18:24 UTC

Use of macrodef

Hello,

  I'm having difficulty using macrodef in Ant 1.6.  It seems to support only one attribute and I need two or more.  Here is an example of my macrodef:

================================================
<macrodef name="phil">
  <attribute name="value"/>
  <sequential>
    <echo message="@{value}"/>
  </sequential>
</macrodef>
================================================

  Which I call it from this target:

================================================
<target name="philTest">
  <phil value="Barclays"/>
</target>
================================================

  It yields the following output:

================================================
philTest:
     [echo] Barclays

BUILD SUCCESSFUL
Total time: 1 second
================================================

  However, when I alter the macrodef like this:

================================================
<macrodef name="phil">
  <attribute name="value"/>
  <attribute name="anotherValue"/>
  <sequential>
    <echo message="@{value}"/>
    <echo message="@{anotherValue}"/>
  </sequential>
</macrodef>
================================================

  and call it from this target:

================================================
<target name="philTest">
  <phil value="Barclays" anotherValue="Global Investors"/>
</target>
================================================

  I always get this message:

================================================
philTest:

BUILD FAILED
E:\Module\gladis\Tools\wl7deploy.xml:321: required attribute anotherValue not set

Total time: 1 second
================================================

  Am I doing something incorrectly or is this a bug?  Thanks.

Phil
  


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Use of macrodef

Posted by Claas Thiele <ct...@ct42.de>.
> philTest:
> 
> BUILD FAILED
> E:\Module\gladis\Tools\wl7deploy.xml:321: required attribute anotherValue not set
> 
> Total time: 1 second
> ================================================
> 
>   Am I doing something incorrectly or is this a bug?  Thanks.
> 
> Phil
>   
It's a bug (Bug 25687).
 From the bugs comment:
"The doc is fixed (for ant 1.6.1) and the code now ignores the case of 
the attribute."

So the workaround for 1.6.0 is using lower case attribute names, as 
Micheal Sunde mentioned.


Claas
-- 
____________________________________________________________________
Dipl.-Inf. Claas Thiele          	EMail: cthiele@ct42.de
Konradstr. 58                    	Web:   http://ct42.de
04315 Leipzig                    	Tel.: +49 (0)341 68 70 92 29
GERMANY                          	Fax   +49 (0)341 68 70 92 30



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org