Wednesday, February 8, 2012

Gradle Groovy Console

Say you have a gradle groovy project, and you're really wishing you had something like "grails console" so you could just run a few quick things. Well, you can! Add this to your build.gradle:

task(console, dependsOn: 'classes', type: JavaExec) {
main = 'groovy.ui.Console'
classpath = sourceSets.main.runtimeClasspath
}

Then type gradle console at command prompt and TADA! Groovy Console pops up with access to all the classes in your gradle project. Hat Tip to Bob: http://jadn.com/~bob/