jastrachan | 13 Apr 17:57 2004

Re: One script calling another

On 13 Apr 2004, at 16:07, John Stump wrote:
> I am able to reference other script files with beta4. Just make
> sure the other script file is in your classpath (although I've
> only tested a CLASSPATH of '.') and when you reference the other
> class, it gets automatically loaded. Note that your other script
> filename should be <classname>.groovy in order for this to work.
> So far, this works when calling "new <otherclass>()" and even
> referencing static methods via: "<otherclass>.method()".
> One thing I cannot get to work, and I have noted here in this
> forum without response, is loading compiled groovy scripts. I
> believe the intention is for groovy scripts to be able to load
> compiled groovy scripts, and vice versa, but it doesn't work for
> me.
> Along the same lines of loading and compiling, does Groovy
> intend on caching compiled classes, and comparing .groovy files
> with .class files and compiling only when the .groovy file is
> newer?

Yes! Sam's already done most of the work for this - its in a class 
called groovy.util.GroovyScriptEngine. There's similar code in 

What we've not yet done is refactor this code so that its shared via 
GroovyClassLoader and GroovyShell (and the interactive shell) so that 
however you're running Groovy it will automatically find any .groovy 
files on the classpath & recompile them lazily on demand as and when