ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shatzer, Larry" <Larry.Shat...@Spirent.com>
Subject antcall with macrodef
Date Tue, 14 Oct 2003 19:59:35 GMT
If your ant file contains antcall and you have macrodef's, and those
macrodefs have default attributes in the <attribute> element, it throws off
this warning:

Trying to override old definition of task <taskname here>

See attached ant file as an example:

<project basedir="." name="test" default="test">

  <macrodef name="test1">
    <attribute default="default value" name="test"/>
    <sequential>
      <echo message="${test}"/>
    </sequential>
  </macrodef>

  <macrodef name="test2">
    <attribute name="test"/>
    <sequential>
      <echo message="${test}"/>
    </sequential>
  </macrodef>

  <target name="test">
    <test1 test="this"/>
    <test1/>
    <test2 test="that"/>
    <!-- Can't call <test2/> due to no default for macrodef test2 -->
    <!--<test2/>-->
  </target>

  <target name="antcall-test">
    <antcall target="test"/>
  </target>

</project>

run ant by itself, no errors or warnings, since antcall is never executed,
but if you run ant with antcall-test, you will see the warning.

Of course, macrodef gets rid of the need for antcall is almost all cases, I
still however have a few antcalls I need to keep, until I figure a way to
convert them to using macrodef, and this warning has been bugging me that
there was something else deeply wrong with 1.6, but as you can see, the
execution happens as expected.

-- Larry

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


Mime
View raw message