You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Jan, Andersson" <Ja...@agriculture.gov.ie> on 2002/12/02 17:11:30 UTC

Creating CallTarget in BSH to make a antcall

Hi!
I'm trying to do an antcall in BeanShell as an alternative to project.executeTarget("X"). This to be able to pass in parameters.
This is the way I tried to do it:

<script language="beanshell"> <![CDATA[
	xyz = project.createTask("CallTarget"); 
	xyz.setTarget("apply.patch_file"); //xyz seems to be null here...
	xyz.execute();
}
   ]]> </script>

I was thinking this should work since this works fine:
	 echo = project.createTask("echo");
       echo.setMessage("Message");

But an exception is thrown:
"file:C:/dev/IMAP_DEV/Tests/build.xml:50: com.ibm.bsf.BSFException: The applicati
on script threw an exception: java.lang.NullPointerException BSF info: <ANT> at
line: 0 column: columnNo
        at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:143)"

Does anyone know about this or might be able to point me in the right direction?
Thanks!
Jan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Creating CallTarget in BSH to make a antcall

Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 2 Dec 2002, Andersson Jan <Ja...@agriculture.gov.ie>
wrote:

> xyz = project.createTask("CallTarget"); 
> xyz.setTarget("apply.patch_file"); //xyz seems to be null here...

Sure it is.  createTask takes the name of the task, not the name of
the class implementing the task.

xyz = project.createTask("antcall"); 

should work.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>