This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 43311

Summary: Possible problem with overriding <macrodef>
Product: java Reporter: Jesse Glick <jglick>
Component: UnsupportedAssignee: David Konecny <dkonecny>
Status: RESOLVED WORKSFORME    
Severity: blocker    
Priority: P3    
Version: 4.x   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 41537    
Attachments: example (ZIP file)

Description Jesse Glick 2004-05-15 03:22:45 UTC
When you run e.g. myapp, you can see warnings:

---%<---
init-macrodef-javac:
Trying to override old definition of task
http://www.netbeans.org/ns/j2se-project/1:javac

init-macrodef-junit:

init-macrodef-nbjpda:
Trying to override old definition of task
http://www.netbeans.org/ns/j2se-project/1:nbjpdastart

init-macrodef-debug:
Trying to override old definition of task
http://www.netbeans.org/ns/j2se-project/1:debug

init-macrodef-java:
Trying to override old definition of task
http://www.netbeans.org/ns/j2se-project/1:java
---%<---

Apparently the macrodef "task" definitions are
inherited in mylib.

1. Produces ugly warnings.

2. If mylib has different macrodefs (e.g. uses an
explicit platform where myapp does not, or
vice-versa... I know this is a weird use case),
what happens?

Should be investigated. Perhaps file a bug for Ant
- <ant inheritall="false"/> ought to not pass
along macrodefs IMHO. inheritrefs="false" doesn't
help either.
Comment 1 David Konecny 2004-05-19 13:25:26 UTC
Created attachment 14995 [details]
example (ZIP file)
Comment 2 David Konecny 2004-05-19 13:31:59 UTC
Fortunately, everything works as expected on Ant 1.6.1. Attached is
ZIP file with two build scripts both defining macro with the same name
and namespace and main script calls the second one. The output is:

D:\temp\ant_macro>ant -f main.xml
Buildfile: main.xml
init:
all:
     [echo] MAIN: This must be myecho from MAIN.xml
init:
Trying to override old definition of task
http://www.netbeans.org/ns/myecho/1:myecho
all:
     [echo] SUB: This must be myecho from SUB.xml
     [echo] MAIN: This must be myecho from MAIN.xml - second try
init:
Trying to override old definition of task
http://www.netbeans.org/ns/myecho/1:myecho
all:
     [echo] SUB: This must be myecho from SUB.xml
     [echo] MAIN: This must be myecho from MAIN.xml - third try
BUILD SUCCESSFUL
Comment 3 Jesse Glick 2004-05-19 18:23:14 UTC
OK. I guess we just ignore the warnings. (Maybe can filter them out
using special Ant loggers.) Thanks for investigating.