Hi 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 http://ant.apache.org/manual/tutorial-writing-tasks.html#NestedElements. This part is fine.
Now, what i've done, is put the same HelloWorld.java 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" /> <helloworld> <message msg="Nested Element 1"/> <message msg="Nested Element 2"/> </helloworld> </target> and the code launching the task simply is (even if called in a different thread): ant = new Project(); helper = new ProjectHelperImpl(); setTaskProperties(); ant.addBuildListener(antTasksListener); ant.init(); helper.parse(ant, antTaskFile); ant.executeTarget(antTarget); by doing this I get the following NullPointerException : Caused by: java.lang.NullPointerException at org.apache.tools.ant.IntrospectionHelper.supportsNestedElement(IntrospectionHelper.java:642) at org.apache.tools.ant.UnknownElement.handleChild(UnknownElement.java:544) at org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.java:326) at org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:182) at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:158) at org.apache.tools.ant.Task.perform(Task.java:363) Then i guess there is a problem with the Nested Element in the HelloWorld.java 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"> </helloworld> </target> 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]