Currently in ant, there is two steps in processing a project build file, a parsing step and an execution step. In the parsing step a DOM like structure of Targets and UnknownElements are build up. These targets and unknown elements are then processed in the execution step. This model works quite ok. One part that does not work like this is the processing of the "id" attribute, these get processed at parsing stage.
This has given rise to a lot of bugs and strange behaviour. http://issues.apache.org/bugzilla/show_bug.cgi?id=34458 http://issues.apache.org/bugzilla/show_bug.cgi?id=36955 http://issues.apache.org/bugzilla/show_bug.cgi?id=37688 http://issues.apache.org/bugzilla/show_bug.cgi?id=21724 This type of bug will happen more as people write larger build files (or equivalate using lots of <import> and <macrodef>) and use shared build files. I propose that we defer handing id's until the processing stage. The change to do this is very small. Index: src/main/org/apache/tools/ant/helper/ProjectHelper2.java =================================================================== --- src/main/org/apache/tools/ant/helper/ProjectHelper2.java (revision 448497) +++ src/main/org/apache/tools/ant/helper/ProjectHelper2.java (working copy) @@ -1007,8 +1007,6 @@ task.setLocation(location); task.setOwningTarget(context.getCurrentTarget()); - context.configureId(task, attrs); - if (parent != null) { // Nested element ((UnknownElement) parent).addChild(task); I have have played a little with this and everthing seems to work fine. Peter