groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alain Stalder <>
Subject [ANN] Grengine 1.3.0 - can be used as class loader for GroovyShell etc.
Date Thu, 20 Jul 2017 09:49:33 GMT
Maybe a simple example explains the new feature in 1.3.0 best:

   def gren = new Grengine(myScriptDir)
   def shell = new GroovyShell(gren.asClassLoader)
   shell.evaluate("<use any Groovy classes in myScriptDir>")

So you can use any Grengine instance as a class loader,
e.g. for GroovyShell or GroovyClassLoader.

(You loose speed if you evaluate Groovy expressions multiple times
compared to using e.g."<some Groovy expression>"), but
on the other hand you can dynamically accumulate classes in the shell,
i.e. things are more dynamic "on top", but rock-solid "at the bottom".)

Release Notes

1.3.0 (20 Jul 2017)

* New methods asClassLoader() for Grengine and Engine that allow to use
   a Grengine resp. its engine as parent class loader for GroovyShell or
   GroovyClassLoader (or any other class loader).

View raw message