ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Roodt <gro...@gmail.com>
Subject Re: using recent Rhino in ant script
Date Sat, 21 Aug 2010 15:32:47 GMT
I've got it working doing using the following Ant project:

    <project default="hello" name="helloworld" basedir=".">
       <target name="hello">
           <script language="javascript" manager="bsf">
           <classpath>
               <fileset dir="rhino-lib" includes="*.jar"></fileset>
           </classpath><![CDATA[
               x=<hello><world/></hello>
            echo = helloworld.createTask("echo");
            for (i=1; i<=10; i++) {

              echo.setMessage(i*i);
              echo.perform();
            }
            echo.setMessage(x);
            echo.perform();

           ]]></script>
       </target>
    </project>

You need the following jars in ./rhino-lib:

bsf.jar (bsf 2.4.0)
http://jakarta.apache.org/site/downloads/downloads_bsf.cgi

commons-logging-1.1.1.jar
http://commons.apache.org/logging/download_logging.cgi

js.jar(rhino 1.7R2) http://www.mozilla.org/rhino/download.html

Not the prettiest, but it works. I will try a bit more to see if I can get
it to work with javax.script.



On Sat, Aug 21, 2010 at 3:35 PM, Jacob Beard <jbeard4@cs.mcgill.ca> wrote:

> Hi,
>
> I just wanted to bump this, as I didn't get an answer before. Or would it
> be better to ask this on the developers mailing list?
>
> Please let me know. Thanks,
>
> Jake
>
>
> On 10-08-19 07:02 PM, Jacob Beard wrote:
>
>> Hi,
>>
>> I've now also posted this question on Stack Overflow:
>> http://stackoverflow.com/questions/3526960/using-recent-rhino-in-ant-script
>>
>> Jake
>>
>> On 10-08-19 03:26 PM, Jacob Beard wrote:
>>
>>> Hi,
>>>
>>> I'm trying to use a recent version of Rhino in an ant <script> tag, but
>>> it seems to be using the version of Rhino that comes bundled with the JVM
>>> instead. I've tried adjusting the classpath to specify the Rhino script jar.
>>> Currently, I've tried the following:
>>>
>>> <project default="hello" name="hello-world" basedir=".">
>>>
>>> <target name="hello">
>>>
>>> <script language="javascript">
>>>
>>> <classpath>
>>>
>>> <pathelement location="js.jar"/>
>>>
>>> </classpath><![CDATA[
>>>
>>>            x=<hello><world/></hello>
>>>
>>>        ]]></script>
>>> </target>
>>>
>>> </project>
>>>
>>>
>>> Notice the inclusion of E4X syntax in the script, which should work only
>>> work in Rhino from Mozilla, and not the one bundled with the JVM.
>>>
>>> js.jar is in the same directory as the ant script. I've also tried
>>> renaming it to rhino.jar, as I think I've seen documentation that suggested
>>> that this was necessary.
>>>
>>> When I run it, it gives the following error:
>>>
>>> javax.script.ScriptException:
>>> sun.org.mozilla.javascript.EvaluatorException: syntax error (<Unknown
>>> source>#3)
>>>
>>> So, it does appear as though it is still using the version of Rhino that
>>> comes with the JVM.
>>>
>>> I'd appreciate any guidance anyone can offer on this. Thanks,
>>>
>>> Jake
>>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message