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
}