Using Command Line Arguments with Gradle BootRun

Using Command Line Arguments with the Spring Gradle BootRun task isn't readily apparent. Here is a very interesting discussion on the topic in this Spring Boot Issue Thread.

How you can do it today is by passing all system properties to the bootRun task as mentioned in the thread, like this.

bootRun {
    systemProperties System.properties
    main = 'com.nixmash.rabbitmq.Application'
}

Then pass the argument on the Command Line as shown in this example, with the jsonconfig argument preceded by -D.

$ gradle -Djsonconfig=true -q bootRun

Posted May 08, 2017 12:54 PM EDT

More Like This Post