ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Reilly" <peter.kitt.rei...@gmail.com>
Subject Re: Script task not found
Date Mon, 24 Apr 2006 15:30:28 GMT
Ant 1.5 is quite old. You should be using ant 1.6.5
Between ant 1.5 and ant 1.6, the provider of bsf moved
from IBM to apache, and this meant that the package
names changed. Thus, you are using an incorrect
version of bsf for ant 1.5.

The current correct combination is:
  *ant 1.6.5
  *bsf *(Note*: Ant 1.6 and later require Apache BSF, not the IBM version.
I.e. you need BSF 2.3.0-rc1 or later.)
  *js (you must use rhino 1.5R3, later or previous verions will not work)

See http://ant.apache.org/manual/install.html#librarydependencies
for details.

Peter
Ps. the script should be something like this:
<project default="setup" name="squares">
  <target name="setup">

   <script language="javascript"> <![CDATA[

     for (i=1; i<=10; i++) {
       echo = project.createTask("echo");
       echo.setMessage(i*i);
       echo.execute();
     }

   ]]> </script>

  </target>
</project>



On 4/24/06, Paul Donaldson <paul.donaldson@seewhy.com> wrote:
>
> Hello,
>
> I need to perform some simple arithmetic on the contents of a string. I
> have
> read that the Script task is suitable for this purpose.
>
> I define my task as:
> <taskdef name="script"
> classname="org.apache.tools.ant.taskdefs.optional.Script">
>
> But I keep getting the message:
> file:build.xml:5: taskdef class
> org.apache.tools.ant.taskdefs.optional.Script cannot be found
>
> I can see the class in optional.jar. optional.jar is in my ant lib folder.
> I
> have tried adding a classpath attribute to the taskdef and setting it to
> the
> ant lib folder, but with the same result.
>
> Does anyone know the reason for this?
>
> Not that it gets this far, but the target that uses the script task is
> defined as:
>
>   <target name="setup">
>
>     <script language="javascript"> <![CDATA[
>
>       for (i=1; i<=10; i++) {
>         echo = squares.createTask("echo");
>         main.addTask(echo);
>         echo.setMessage(i*i);
>       }
>
>     ]]> </script>
>
>   </target>
>
> I am using Ant version 1.5.1
> I have downloaded and installed to ANT_HOME/lib:
> js.jar version 1.6 R2 from www.mozilla.org/rhino/
> bsf.jar 2.3.0 from jakart.apache.org/bsf/
>
> Many thanks,
> Paul
>
>
>
> ---------------------------------------------------------------------
> 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