Created
August 19, 2012 16:41
-
-
Save sazzer/3396114 to your computer and use it in GitHub Desktop.
Loading Groovy scripts as classes at runtime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GroovyClassloaderTest { | |
@Test | |
public void loadGroovyScript() throws Exception { | |
CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); | |
compilerConfiguration.setClasspath("/base/directory/containing/groovy/files"); | |
GroovyClassLoader gcl = new GroovyClassLoader(getClass().getClassLoader(), compilerConfiguration); | |
Class<?> cls = gcl.loadClass("SampleClass", true, true, true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment