The easiest solution is to use the Application Plugin, which among other things provides a run
task. To make the main class configurable from the command line, you’ll have to set mainClassName
to the value of some system (or project) property, and then pass that property from the command line:
apply plugin: "application"
mainClassName = System.getProperty("mainClass")
Now you can run the application with gradle run -DmainClass=thornydev.App
.