You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Bart van der Schoor <ba...@gmail.com> on 2011/07/21 11:02:57 UTC

Beginner question: Ant+ Eclipse + script-task: BSF's & Rhino E4X issue

Hi,

I'm new to Ant and advanced usage of Eclipse, and I got terribly lost while
trying to solve the following. Worst of all i have no idea where to turn to
solve this so i hope somebody here can help more of point me in the right
direction (so many projects).

I have an Ant script-task using javascript where I want to parse XML using
E4X.  If I check the Ant project page I see it uses BSF which in turn uses
Rhino. But the E4X doesn't work: it seems like the Rhino it's using doesn't
have it supported. But when i browse Rhino's release I see it in 1.6, which
dates to 2004 (http://www.mozilla.org/rhino/rhino16R1.html).

The i tried to find out which version of Rhino is being used by the Ant
that's in my Eclipse, and tthen it all goes foggy. I tried googling and
browsing the different projects, but it's so confusing. I also tried
browsing release notes, but i have no idea which project to look in.

Can anyone give me some pointers on this?

I'm using Ant 1.8.2 in FDT, which is a standalone version of an ActionScript
plugin for Eclipse. It's FDT 4.5, which runs on Eclipse 3.5.0. It originally
shipped with Ant 1.7.1, but when solving an issue with the FTP task the
support guys send me an updated Ant 1.8.2 and the additional jar's
(commons-net and jakarta-oro). My workstation is an Windows XP machine, and
is using Sun jdk1.6.0_21.

Grtz,

Bart

Re: Beginner question: Ant+ Eclipse + script-task: BSF's & Rhino E4X issue

Posted by Bart van der Schoor <ba...@gmail.com>.
Good pointer, I'd never found that out.

It took me some time to follow through (learning fast) but I confirm it
totaly works! And all on 64 bit on my Vista home-rig.. yes yes :)

What i did was to get the preview from jdk7.java.net, then google-out how to
rig eclipse to use it (-vm in eclipse.ini), and finally also let Ant in
(nice one that).

But at last, javascript 1.8 and E4X, it's awesome. Thanks a lot!

Grtz,

Bart


2011/7/21 Peter Reilly <pe...@gmail.com>

> The problem you are running into is that a version of rhino
> is in java itself (since jdk 6)
> and this version is in the root classloader and so using
> a different version is very hard (I cannot remember how to
> do it).
>
> The good news is that with jdk 7, the embedded rhino
> has been updated to a newer version see:
> http://bugs.sun.com/view_bug.do?bug_id=6980447
>
> This means that using jdk 7 and ant 1.8
> the following build.xml  works:
>
> <project default="e4x">
>  <target name="e4x">
>    <script language="javascript"><![CDATA[
>      importPackage(java.lang);
>      var doc = <a><b c="1"/><b c="2"/></a>;
>      doc.@c="new value";
>      System.out.println(doc);
>        ]]>
>    </script>
>  </target>
> </project>
>
> without messing around with bsf.
>
> since ant will in this case use javax.scripting
>
> Peter
>
>
> On Thu, Jul 21, 2011 at 10:02 AM, Bart van der Schoor
> <ba...@gmail.com> wrote:
> > Hi,
> >
> > I'm new to Ant and advanced usage of Eclipse, and I got terribly lost
> while
> > trying to solve the following. Worst of all i have no idea where to turn
> to
> > solve this so i hope somebody here can help more of point me in the right
> > direction (so many projects).
> >
> > I have an Ant script-task using javascript where I want to parse XML
> using
> > E4X.  If I check the Ant project page I see it uses BSF which in turn
> uses
> > Rhino. But the E4X doesn't work: it seems like the Rhino it's using
> doesn't
> > have it supported. But when i browse Rhino's release I see it in 1.6,
> which
> > dates to 2004 (http://www.mozilla.org/rhino/rhino16R1.html).
> >
> > The i tried to find out which version of Rhino is being used by the Ant
> > that's in my Eclipse, and tthen it all goes foggy. I tried googling and
> > browsing the different projects, but it's so confusing. I also tried
> > browsing release notes, but i have no idea which project to look in.
> >
> > Can anyone give me some pointers on this?
> >
> > I'm using Ant 1.8.2 in FDT, which is a standalone version of an
> ActionScript
> > plugin for Eclipse. It's FDT 4.5, which runs on Eclipse 3.5.0. It
> originally
> > shipped with Ant 1.7.1, but when solving an issue with the FTP task the
> > support guys send me an updated Ant 1.8.2 and the additional jar's
> > (commons-net and jakarta-oro). My workstation is an Windows XP machine,
> and
> > is using Sun jdk1.6.0_21.
> >
> > Grtz,
> >
> > Bart
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: Beginner question: Ant+ Eclipse + script-task: BSF's & Rhino E4X issue

Posted by Peter Reilly <pe...@gmail.com>.
The problem you are running into is that a version of rhino
is in java itself (since jdk 6)
and this version is in the root classloader and so using
a different version is very hard (I cannot remember how to
do it).

The good news is that with jdk 7, the embedded rhino
has been updated to a newer version see:
http://bugs.sun.com/view_bug.do?bug_id=6980447

This means that using jdk 7 and ant 1.8
the following build.xml  works:

<project default="e4x">
  <target name="e4x">
    <script language="javascript"><![CDATA[
      importPackage(java.lang);
      var doc = <a><b c="1"/><b c="2"/></a>;
      doc.@c="new value";
      System.out.println(doc);
        ]]>
    </script>
  </target>
</project>

without messing around with bsf.

since ant will in this case use javax.scripting

Peter


On Thu, Jul 21, 2011 at 10:02 AM, Bart van der Schoor
<ba...@gmail.com> wrote:
> Hi,
>
> I'm new to Ant and advanced usage of Eclipse, and I got terribly lost while
> trying to solve the following. Worst of all i have no idea where to turn to
> solve this so i hope somebody here can help more of point me in the right
> direction (so many projects).
>
> I have an Ant script-task using javascript where I want to parse XML using
> E4X.  If I check the Ant project page I see it uses BSF which in turn uses
> Rhino. But the E4X doesn't work: it seems like the Rhino it's using doesn't
> have it supported. But when i browse Rhino's release I see it in 1.6, which
> dates to 2004 (http://www.mozilla.org/rhino/rhino16R1.html).
>
> The i tried to find out which version of Rhino is being used by the Ant
> that's in my Eclipse, and tthen it all goes foggy. I tried googling and
> browsing the different projects, but it's so confusing. I also tried
> browsing release notes, but i have no idea which project to look in.
>
> Can anyone give me some pointers on this?
>
> I'm using Ant 1.8.2 in FDT, which is a standalone version of an ActionScript
> plugin for Eclipse. It's FDT 4.5, which runs on Eclipse 3.5.0. It originally
> shipped with Ant 1.7.1, but when solving an issue with the FTP task the
> support guys send me an updated Ant 1.8.2 and the additional jar's
> (commons-net and jakarta-oro). My workstation is an Windows XP machine, and
> is using Sun jdk1.6.0_21.
>
> Grtz,
>
> Bart
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org