ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Nested Element not retieved
Date Fri, 26 Sep 2008 09:50:36 GMT

I'm trying to use ant to perform some operations outside a build process and I'm having a
problem dealing with nested elements.
First I made work the code found in the "writing tasks tutorial" at
This part is fine.

Now, what i've done, is put the same file, without any modifications,  in
a jar built with maven (having ant ant ant-launcher as dependencies). At execution the main
class tries to launch the ant task using the modified xml file like this :

    <target name="use" description="Use the Task" >
        <taskdef name="helloworld" classname="test.HelloWorld" />
            <message msg="Nested Element 1"/>
            <message msg="Nested Element 2"/>

and the code launching the task simply is (even if called in a different thread):

     ant = new Project();
        helper = new ProjectHelperImpl();
        helper.parse(ant, antTaskFile);

by doing this I get the following NullPointerException :

Caused by: java.lang.NullPointerException

Then i guess there is a problem with the Nested Element in the class, maybe
with the classpath (i tried some things with it without any result).
What I don't get is that if i change the xml File for 

  <target name="use" description="Use the Task" >
        <taskdef name="helloworld" classname="test.HelloWorld" />
        <helloworld message="someMessage"> 

without changing the class, it works and the Task is properly executed. Then it seems I can
give a variable to my Task but not a nested element.

 I'm using ant 1.6.5.

If someone has any ideas, i would be really gratefull.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message