Java Mailing List Archive

Apache Ant Archive

» Ant Users List
» Ant Developers List
Does scriptdef <element > use ant:current xmlns when defined in antlib?

Does scriptdef <element > use ant:current xmlns when defined in antlib?

2007-06-11       - By Vladimir Volod'ko
Reply:     1     2     3     4  


I'm trying to put my script tasks in antlib and wonder why hte following code
does not work:

# complex/antlib.xml
<?xml version="1.0"?>
<antlib xmlns:cur="ant:current">

   <!-- Elementary task script -->
   <scriptdef name="elem" language="javascript" >
   <attribute name="name"/>
   <!-- Macro uses element -->
   <macrodef name="complex_macro">
          <cur:elem name="macro element" />

   <!-- Script for testing some ideas -->
   <scriptdef name="complex_script" language="javascript">
       <!-- This is not working as expected.
          Error is:
          build.xml:12: <antlib:complex:complex_script> is unable to create
the <elem> nested element
       <element name="elem" type="cur:elem"/>

       <!-- This is Ok, but requires fully specified java package for current
antlib -->
       <!-- element name="elem" type="antlib:complex:elem"/-->
           self.log("elements inside script:");
       var elems = elements.get("elem");
       if (elems) {
               for (i = 0; i < elems.size(); ++i) {
               var elem = elems.get(i);

# build.xml
<?xml version="1.0"?>
<project name="elem_testing" default="test" basedir="."

   <taskdef uri="antlib:complex"

   <target name="test" >
     <my_lib:elem name="single element" />
      <my_lib:complex_macro />
     <my_lib:elem name="element in script" />


To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 - Jax Systems, LLC, U.S.A.