Bug 39786 - project.createTask() does not work for presets
Summary: project.createTask() does not work for presets
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-12 15:02 UTC by Peter Reilly
Modified: 2008-02-22 12:18 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Reilly 2006-06-12 15:02:00 UTC
The following does not work:
<presetdef name="hello-there">
 <echo>Hello There</echo>
</presetdef>

<script language="beanshell">
  import org.apache.tools.ant.taskdefs.MacroInstance;
  import org.apache.tools.ant.BuildException;

  task = project.createTask("hello-there");  // error
</script>

This will throw a

 java.lang.ClassCastException
    at
org.apache.tools.ant.ComponentHelper.createNewTask(ComponentHelper.java:462)