https://bz.apache.org/bugzilla/show_bug.cgi?id=59339
Bug ID: 59339
Summary: Setting attribute via direct call to
setDynamicAttribute does not work for a task defined
via macrodef
Product: Ant
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P2
Component: Core
Assignee: [email protected]
Reporter: [email protected]
I create a task via macroDef. The task has a mandatory attribute whose name is
camel case. Later in the build script, I create an instance of the task in a
JavaScript snippet, set the attribute value via a call to setDynamicAttribute,
and execute the task.
I get the error message that the attribute is not set.
If in the call to setDynamicAttribute I specify the attribute name in lower
case, everything works as expected.
A problem from the same area was reported and fixed in Bug 25687.
Here's an example:
<project default="MyTarget">
<macrodef name="MyEcho">
<attribute name="myMessage"/> <!-- Note the camel case name -->
<sequential>
<echo>@{myMessage}</echo>
</sequential>
</macrodef>
<target name="MyTarget">
<script language="JavaScript">
var myTask = project.createTask("MyEcho");
// The following line does not work despite the fact that the
// attribute name is spelled correctly, i.e. as camelCase
myTask.setDynamicAttribute("myMessage", "Hello");
// The following line would work
// myTask.setDynamicAttribute("mymessage", "Hello");
myTask.perform();
</script>
<!--MyEcho myMessage="Hello"/--> <!-- This works as well -->
</target>
</project>
--
You are receiving this mail because:
You are the assignee for the bug.