You just need to use the Gradle Application plugin:
apply plugin:'application'
mainClassName = "org.gradle.sample.Main"
And then simply gradle run
.
As Teresa points out, you can also configure mainClassName
as a system property and run with a command line argument.