Groovy console

I would like to be able to interact with my code in a flexible way using Groovy console. This idea is similar to the rails console (http://guides.rubyonrails.org/command_line.html#rails-console). By executing the console task, gradle would open the Groovy console already loaded with my runtime dependencies, including my own code.

Here is how I usually implement this on my own:

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

Raised as GRADLE-2880. With the recent revival of groovysh, it would be worthwhile to support that too. For example, the Groovy plugin could offer two tasks (e.g. ‘GroovyConsole’ and ‘GroovyShell’) per configuration, preconfigured with the corresponding class path.