Skip to content

Instantly share code, notes, and snippets.

View mariogarcia's full-sized avatar

Mario Garcia mariogarcia

View GitHub Profile
@mariogarcia
mariogarcia / groovy-in-osgi-env
Created June 15, 2017 12:13 — forked from felixdo/groovy-in-osgi-env
run scripts from inside eclipse workbench
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);
@mariogarcia
mariogarcia / Dockerfile
Last active August 29, 2015 14:10 — forked from melix/Dockerfile
################################################
# Dockerfile to run Groovy containers
# Based on Java 8 image
################################################
FROM java:8u40-jdk
MAINTAINER Cédric Champeau
RUN apt-get update
@GrabResolver(name='grails-core', root='http://repo.grails.org/grails/core')
@Grab(group='org.grails', module='grails-datastore-gorm-mongo', version='1.0.0.BUILD-SNAPSHOT')
@Grab(group='org.slf4j', module='slf4j-simple', version='1.6.1')
import grails.persistence.*
import org.grails.datastore.gorm.mongo.config.*
MongoDatastoreConfigurer.configure("myDatabase", Book)
Book.withSession {