apply plugin: 'groovy' repositories { mavenCentral() } dependencies { compile 'org.codehaus.groovy:groovy-all:2.0.5' } task runScript (dependsOn: 'classes', type: JavaExec) { main = 'myscript' classpath = sourceSets.main.runtimeClasspath }
References
https://stackoverflow.com/questions/17360719/running-groovy-scripts-from-gradle
https://mrhaki.blogspot.com/2014/09/gradle-goodness-running-groovy-scripts.html