The problem is most likely the default value for the "dest" attribute
if you are using <ant>, <antcall> or <subant>

For example:
<project default="caller">
 <macrodef name="copy.compile.post">
   <attribute name="dest"
              default="${dir.bin.work}"/>
   <sequential>
   </sequential>
 </macrodef>
 <target name="called">
 </target>
 <target name="caller">
   <property name="dir.bin.work" value="."/>
   <antcall target="called"/>
 </target>
</project>

this issue was reported as bug 31215.
http://issues.apache.org/bugzilla/show_bug.cgi?id=31215

This issue are happened a number of times, so I think
that the ant code could be modified to allow macrodefs that are different in
contents (due to property values changing) but otherwise the same to
be treated as "similar"  - resulting in a log message at verbose level and
not at warning level.

Peter

David Resnick wrote:

<macrodef name="copy.compile.post">
<attribute name="includes" description="pattern of files to include in
copy" default="**/*.dll **/*.exe **/*.map"/>
<attribute name="source" description="root of dir to copy files from"/>
<attribute name="dest" description="dir to copy files to"
default="${dir.bin.work}"/>
<sequential>
 <copy todir="@{dest}" flatten="true">
  <fileset dir="@{source}" includes="@{includes}">
   <date datetime="${__bin.timestamp}" when="after"
pattern="yyMMddHHmmss"/>
  </fileset>
 </copy>
</sequential>
</macrodef>

-----Original Message-----
From: Peter Reilly [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 15, 2005 12:44
To: Ant Users List
Subject: Re: Why "Trying to override old definition of task xxx" message?


What does the macrodef look like?

Peter

David Resnick wrote:



I renamed the macro attributes (which were includes, source and dest) to
names that are definitely not in use, but there is no change.

I also thought that the problem might be with the name of the macro


clashing


with the copy task, but as I also have a copy.compile.pre macro that


doesn't


cause the warning, that isn't it either.

-----Original Message-----
From: Peter Reilly [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 09, 2005 16:03
To: Ant Users List
Subject: Re: Why "Trying to override old definition of task xxx" message?


If you use <ant> or <antcall> and if the "copy.compile.post" macro
contains text or attributes that have embedded properties (like "${name}")
which may change when the a new project is used, the macro
contents will be different and the ant core code will whine about
a change to the macro.

There is a bug report about this (cannot remember the number) from
a netbeans developer.

Peter

David Resnick wrote:





As best as I can see it, I am only defining it once.

This is the situation:

There are 2 files: Main.xml and tools.xml.

In Main.xml (directly inside the project element) I have:

<import file="tools.xml"/>


Inside targets in Main.xml I use the copy.compile.post macro.


In tools.xml (also directly inside the project element) I have:

        <macrodef name="copy.compile.post">
                .
                .
                .
        </macrodef>

...along with a dozen other macros.


copy.compile.post is the only macro that Ant complains about, and it only
complains some of the time (I haven't been able to see a pattern about


when


it complains).

-David

-----Original Message-----
From: Peter Reilly [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 09, 2005 15:25
To: Ant Users List
Subject: Re: Why "Trying to override old definition of task xxx" message?


Looks like you are redefining a macrodef.

For exmple:

<target name="compile" depends="copy">
<macrodef name="doit" .../>
<doit/>
</target>

<target name="copy">
<macrodef name="doit" .../>
<doit/>
</target>

Would cause the macro "doit" to be defined twice.
Normally, one would place macrodefs outside of targets
and give them different names.

<macrodef name="copy_it".../>

<macrodef name="compile_it" ../>

<target name="compile" depends="copy">
<compile_it/>
</target>

<target name="copy">
<copy_it/>
</target>

Peter

David Resnick wrote:







I have a project with a dozen macrodef definitions. Today I added 2 more






and






now get the message "Trying to override old definition of task xxx" for




one




of the new macros at the start of most targets. The message doesn't seem




to




have any effect on the build, but I would like to know why it suddenly
appeared.



Does anyone know?



Thanks, David










---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]









---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]









---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to