DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9675>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9675 Custom tasks can be run in an unconfigured state Summary: Custom tasks can be run in an unconfigured state Product: Ant Version: 1.5Beta2 Platform: PC URL: http://www.netbeans.org/issues/show_bug.cgi?id=24489 OS/Version: Linux Status: NEW Severity: Major Priority: Other Component: Core AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] This bug is a regression in 1.5 from earlier releases, which is why I chose "Major" as severity. It seems that in some, but not all, cases, defining and running a custom task twice in Ant 1.5 will (1) result in a strange warning, (2) leave the task unconfigured (no setters called). Unzip the attached test case and try running the script with different versions of Ant. The script has a target 'once' which defines and runs a custom task with a property set. 'twice' calls 'once' twice with <antcall>. I tried both ant twice and ant once once on the same script. These behave *differently* for whatever reason. Ant 1.3: "ant once once" does not redefine the task at all. The old copy is silently used. However the call works when called either way, other than the task not being reloaded. Ant 1.4: "ant twice" creates extra instances of the task but this seems harmless; the class is redefined. "ant once once" now redefines the class but not (apparently) the actual task instance: the property is set only once. Again the task works called either way. Ant 1.5 (beta 2): "ant twice" has apparently been fixed to not create an extra instance; works fine. "ant once once" however is broken on the second pass. The message Trying to override old definition of task t appears, and a new task instance is created but never configured. When run, it is in an uninitialized state. Build scripts which thus called a taskdef twice, and which worked in previous releases, now do not. Cf. NetBeans build system bug in URL - for which a good workaround probably exists. In the NetBeans case, a custom task was calling Project.executeTarget in such a way as to cause the target containing the <taskdef> and custom task to be run twice on the same project (unintentionally). For some reason, it seems Ant's own <antcall> does not suffer from this problem. But listing the target twice on the command-line does. Did not try <ant>. There does not seem to be any documentation describing this phenomenon. I would guess that using loaderrefs on <taskdef> in Ant 1.5 (or <classpath> IDs?) would work around it, assuming you did not want to try to reload the taskdef class. The WHATSNEW mentions only this: * <taskdef> and <typedef> will now emit a warning if a task/type of the given name already exists. but says nothing of unconfigured tasks being run, nor of why this would happen only in some usages. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
