views:

175

answers:

1

I need to run some external code from my Java application that will be updated frequently and orthogonally to the rest of the application. As I do not to re-deploy the entire application for every code change (and for other reasons as well) we chose to use groovy for this code, and store it either on the file system or in the database.

From the documentation I understand I have two ways to run the code - Using the GroovyShell or the GroovyClassLoader (eval does not fit here)

What are the pros and cons of each method?

+1  A: 

GroovyShell uses GroovyClassLoader underneath. Use GroovyShell unless you need a feature that's only provided by GroovyClassLoader.

Peter Niederwieser
But does the GroovyShell cache the executed script?
David Rabinowitz