What is the gradle equivalent of maven’s exec plugin for running Java apps?

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)