Community
Participate
Working Groups
When attempting to override one of Ant's optional tasks with a new class, org.eclipse.ant.core ignores the new task definition. It is important to note that the new task must be a subclass of the original task for this behaviour to occur. This behaviour occurs on the builds for 20011018 and 20011025. To reproduce the bug from a clean 20011025 build: - add the junit.jar file to org.eclipse.ant.core - make sure that the junit.jar file is exported by the plugin.xml file. Add these lines: <library name="junit.jar"> <export name="*"/> </library> - start eclipse - create a new plugin project called org.eclipse.bug, and use the default plugin generator. - add a dependancy on org.eclipse.ant.core in the plugin.xml - add the jar files nat.jar and jakarta-ant-1.3-optional.jar to the build path - create a new class in the org.eclipse.bug package, called Foo. Make sure that Foo is a subclass of org.apache.tools.ant.taskdefs.optional.junit.JUnitTask. The file Foo.java should look like: package org.eclipse.bug; import org.apache.tools.ant.taskdefs.optional.junit.JUnitTask; public class Foo extends JUnitTask { public Foo() throws Exception { throw new Exception("This is the Foo class."); } } - add extensions to the org.eclipse.ant.core.antTasks extension point in the plugin.xml. Here we create tasks called <junit> and <foo> which are both defined by the same class, org.eclipse.bug.Foo. <extension point="org.eclipse.ant.core.antTasks"> <antTask name="junit" class="org.eclipse.bug.Foo"/> <antTask name="foo" class="org.eclipse.bug.Foo"/> </extension> - exit eclipse - copy the org.eclipse.bug folder from workspace to plugins - restart eclipse with the option "-dev bin" - create an Ant script called foo.xml containing the text: <project name="Bugs" default="run"> <target name="run"> <foo /> </target> </project> - create an Ant script called junit.xml containing the text: <project name="Bugs" default="run"> <target name="run"> <junit /> </target> </project> - right click on foo.xml, and select 'Run Ant...' from the drop down menu to run the Ant script. Make sure the run target is selected and hit finish. Notice that running the script pops up an error box reporting that a java.lang.Exception was thrown with the message "This is the Foo class." - run junit.xml in the same way. Notice that the run executes without popping up the expected dialogue box. Since running foo.xml works as expected, this shows that the class org.eclipse.bug.Foo is being found, and that the extension point org.eclipse.ant.core.antTask is working properly when not overriding a name that it already knows. However, when ruinning with the <junit> name, Eclipse does not seem to be finding the overriding class, or it is being ignored.
There was a problem in EclipseProject.createTask() and EclipseProject.createDataType() where it was looking for the default implementation before looking for the implementation defined by plug-ins extension points. Fixed. Released into HEAD.
Fixed in v211