Groovy Object

task groovy << {}

class GroovyGreeter {
	String greeting = "Default greeting"
	def printGreeting(){println "Greeting: $greeting" }
}

def myGroovyGreeter = new GroovyGreeter()

myGroovyGreeter.printGreeting()
myGroovyGreeter.greeting = "My custom greeting"
myGroovyGreeter.printGreeting()
[vagrant@localhost ud867]$ gradle groovy
Greeting: Default greeting
Greeting: My custom greeting
:groovy

BUILD SUCCESSFUL

Total time: 6.641 secs