ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geoff Krapf" <>
Subject Script task in imported files seem to fail
Date Thu, 03 Feb 2005 14:26:57 GMT
I just started playing around with a script task, and ran into a weird
problem.  I'm using the script in a build file that's imported into other
build files using the <import> task, i.e., build.xml imports import.xml at
the beginning of the build.xml file (right after the <project> node

Inside import.xml I've got a <macrodef> that calls the <script> task.  The
script task is language="javascript".  I have bsf.jar and js.jar in my Ant
lib/.  The script is extremely simple, it's just converting a date stamp
from one format to another.

When I put a simple target in my import.xml and call my macro, and a execute
that target using "ant -f import.xml run-macro", everything works fine.  If
I make a call to that macro from build.xml, I get this error:

C:\Projects\build.xml:675: The following error occurred while executing this
C:\Projects\import.xml:80: The following error occurred while executing this
C:\Projects\import.xml:54: The following error occurred while executing this
C:\Projects\import.xml:24: ConversionError: The undefined value has no

If I remove all of the lines in the JavaScript the build works (well, it
gets to the point where it needed the results of that script); if I have
just one line, and importClass statement, I get this error.

My guess is that the project context is not being passed correctly into the
import/macrodef/script chain, because the source has these lines
in execute():


        runner.addBean("project", getProject());
        runner.addBean("self", this);

But I don't really know.  Anyone have any ideas?


- Geoff

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

View raw message