The easiest is probably to use application plugin. Add apply plugin: 'application'
to your build.gradle and set mainClassName = com.bla.MainRunner
. To add arguments to your main class modify the run task and edit the args property
run {
args += 'first_arg'
}
Classpath is taken automatically from main sourceSet, if you want different one, you can edit classpath property of the run task.
If you need more customization, you can define your own task of type JavaExec like this
task myRun(type: JavaExec) {
classpath sourceSets.main.runtimeClasspath
main = "com.bla.MainRunner"
args "arg1", "arg2"
}