ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daryl Coutinho <Daryl.Couti...@Bcone.com>
Subject using antcall from javascript
Date Tue, 04 Sep 2001 22:31:12 GMT
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


Mime
View raw message