ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From AirTraffic <airtraffic....@gmail.com>
Subject Re: How can I call a macro instance from a script task
Date Fri, 05 Sep 2008 00:16:25 GMT

I have to modify the case I listed above. Actually if the macrodef part is
defined in the same file as the script part, it works. 

It doesn't work if I add namespace here:
<project name= "test" xmlns:my="my:/my.com">
<target name= "test"> 
<script language= "..."><![CDATA[ 
newTask = project.createTask("my:my-macro"); 
newTask.setDynamicAttribute( "host", "bingo"); 
newTask.execute(); 
]] ></script> 
</target> 
</project>

"my-macro" is defined in another file, say, lib.xml and use:
<typedef file="lib.xml" uri="my:/my.com"/>

Any hint?


AirTraffic wrote:
> 
> I know somebody already asked this question a few years ago, but I
> couldn't find the answer, so try again
> 
> 
> I use Ant 1.6.5
> <project name= "test"> 
> <macrodef name= "my-macro"> 
> <attribute name= "host"/ > 
> <sequential> 
> <echo>macro called with host '${host}'</echo> 
> </sequential> 
> </macrodef > 
> 
> <target name= "test"> 
> <script language= "..."><![CDATA[ 
> newTask = project.createTask("my-macro"); 
> newTask.setDynamicAttribute( "host", "bingo"); 
> newTask.execute(); 
> ]] ></script> 
> </target> 
> </project > 
> 
> This returns: 
> org.mozilla.javascript.EcmaError: TypeError: Cannot call method
> "setDynamicAttribute" of null 
> 
> Any help would be appreciated!
> 

-- 
View this message in context: http://www.nabble.com/How-can-I-call-a-macro-instance-from-a-script-task-tp19319842p19322548.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message