Hmm. I'm unable to reproduce it independent of my real build files. It's a very long and complicated build file, so it must be something in there.
Sorry for (almost starting) the wild goose chase. - Geoff -----Original Message----- From: Peter Reilly [mailto:[EMAIL PROTECTED] Sent: Thursday, February 03, 2005 10:11 AM To: Ant Users List Subject: Re: Script task in imported files seem to fail Can you provide a small example of the problem ? Peter Geoff Krapf wrote: >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 opening). > >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 >line: >C:\Projects\import.xml:80: The following error occurred while executing this >line: >C:\Projects\import.xml:54: The following error occurred while executing this >line: >C:\Projects\import.xml:24: ConversionError: The undefined value has no >properties. > >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 Script.java source has >these lines in execute(): > > runner.addBeans(getProject().getProperties()); > runner.addBeans(getProject().getUserProperties()); > runner.addBeans(getProject().getTargets()); > runner.addBeans(getProject().getReferences()); > > runner.addBean("project", getProject()); > runner.addBean("self", this); > >But I don't really know. Anyone have any ideas? > >Thanks, > >- Geoff > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]