Created
June 15, 2017 11:30
-
-
Save felixdo/ca6d46ab54a95791800ced4e6f3a8f05 to your computer and use it in GitHub Desktop.
run scripts from inside eclipse workbench
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
Bundle groovy = Platform.getBundle("org.codehaus.groovy"); | |
final GroovyClassLoader transformLoader = new GroovyClassLoader(groovy.adapt(BundleWiring.class).getClassLoader()); | |
GroovyClassLoader loader = new GroovyClassLoader(getClass().getClassLoader()) { | |
@Override | |
protected CompilationUnit createCompilationUnit(CompilerConfiguration config, CodeSource source) { | |
return new CompilationUnit(config, source, this, transformLoader, true, null, null); | |
} | |
}; | |
Class<?> cl = loader.parseClass(new GroovyCodeSource(capellaScriptFile.getLocation().toFile(), capellaScriptFile.getCharset())); | |
InvokerHelper.runScript(cl, args); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment