The documentation of the script task states:

"All items (tasks, targets, etc) of the running project are accessible from
the script, using either their name or id attributes (as long as their
names are considered valid Java identifiers, that is). "

However, the following fails:

<?xml version="1.0"?>
<project name="test" default="main" basedir=".">
  <target name="sub">
    <echo id="foo">Executing a task</echo>
  </target>

  <!-- tests the script stuff -->
  <target name="main">
    <script language="javascript"><![CDATA[
        foo.setMessage("I'm a foo!")
        sub.execute()
    ]]></script>
  </target>
</project>

Surely there are more limitations? Besides, failure modes are different in
Rhino (unable to create engine) and Nashorn (reference not defined).

Regards,
Gintas

Reply via email to