You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Daryl Coutinho <Da...@Bcone.com> on 2001/09/05 00:31:12 UTC
using antcall from javascript
hi,
well i've been trying to use the script tag to call another target, but i
always get a null pointer exception. my code looks like this:
<project name="sample" default="test" basedir=".">
<target name="test">
<property file="../build.properties" />
<script language="javascript"> <![CDATA[
antcall=sample.createTask('antcall');
antcall.init();
antcall.setTarget('some');
antcall.execute();
]]> </script>
</target>
<target name="some">
<echo message="inside some" />
</target>
</project>
The error log looks like this:
--- Nested Exception ---
java.lang.NullPointerException
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:206)
at
org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:103)
at java.lang.reflect.Method.invoke(Native Method)
at
org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:21
6)
at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1216)
at
org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1679)
at
org.mozilla.javascript.InterpretedScript.call(InterpretedScript.java:
63)
at
org.mozilla.javascript.InterpretedScript.exec(InterpretedScript.java:
54)
at org.mozilla.javascript.Context.evaluateReader(Context.java:741)
at org.mozilla.javascript.Context.evaluateString(Context.java:705)
at
com.ibm.bsf.engines.javascript.JavaScriptEngine.eval(JavaScriptEngine
.java:83)
at com.ibm.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:106)
at com.ibm.bsf.BSFManager.exec(BSFManager.java:479)
at
org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:110
)
at org.apache.tools.ant.Target.execute(Target.java:153)
at org.apache.tools.ant.Project.runTarget(Project.java:898)
at org.apache.tools.ant.Project.executeTarget(Project.java:536)
at org.apache.tools.ant.Project.executeTargets(Project.java:510)
at org.apache.tools.ant.Main.runBuild(Main.java:421)
at org.apache.tools.ant.Main.main(Main.java:149)
Am i missing something here. Any help would be appreciated
thanks in advance
Daryl
Re: using antcall from javascript
Posted by Nico Seessle <ni...@apache.org>.
using antcall from javascript
From: Daryl Coutinho
To: 'ant-dev@jakarta.apache.org '
Sent: Wednesday, September 05, 2001 12:31 AM
Subject: using antcall from javascript
hi,
well i've been trying to use the script tag to call another target, but i always get a null pointer exception. my code looks like this:
<project name="sample" default="test" basedir=".">
<target name="test">
<property file="../build.properties" />
<script language="javascript"> <![CDATA[
antcall=sample.createTask('antcall');
antcall.init();
antcall.setTarget('some');
antcall.execute();
]]> </script>
</target>
<target name="some">
<echo message="inside some" />
</target>
</project>
Am i missing something here. Any help would be appreciated
Unfortunately you don't tell us the Ant version you are using. Your example works fine for me using Ant 1.4, so I suggtest you should try this.
(And please read http://jakarta.apache.org/site/mail.html)
Nico
Re: using antcall from javascript
Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 4 Sep 2001, Daryl Coutinho <Da...@Bcone.com> wrote:
> i've been trying to use the script tag to call another target, but i
> always get a null pointer exception.
This is a known bug in Ant 1.3, has been fixed in 1.4.
Stefan