ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bickford, Mark" <>
Subject SCRIPTDEF using Java
Date Tue, 27 Jul 2010 18:57:58 GMT

I've tried everything I can think of to get this to work, but so far
everything has failed.  I am writing a scriptdef using Java as the
language, but I can't find how to access any of the predefined beans
like attributes and elements.  This much works:

<project name="javaScriptingTest" default="script.test">

   <scriptdef name="javatest" manager="javax" language="java">
      <attribute name="teststring"/>
      class javatest
      	public static void main(String[] args) {
      		System.out.println("Number of args: "+args.length);
      		//System.out.println("The list is: "+
      		System.out.println("Hello world!");
   <target name="script.test">
      <javatest teststring="Success!!!  Can you believe it???"/>

The command-line I am using (on WinXP) is 
> ant -lib C:\work\lib\java-script-engine\ -f mini-build.xml

(java-script-engine holds the java-engine.jar from the JSR 223 home page

When I run it as I have things above, it works.  When I uncomment any of
the printlns shown, I get (e.g.):

 [javatest] mfm:///$ cannot find symbol
 [javatest] symbol  : variable attributes
 [javatest] location: class javatest

I realize that println of attributes wouldn't give anything really
meaningful, but it would prove the object exists.  How can we access
those beans when Java is the script language?  Am I missing an import,
or is there something else that needs to happen?

Mark H. Bickford 

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

View raw message