Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add command line properties with gradle bootRun?

24.3 Application Property Files uses the following command to add an application property spring.config.name:

$ java -jar myproject.jar --spring.config.name=myproject

How can I do this with gradle bootRun?

like image 409
Jingguo Yao Avatar asked Aug 22 '18 13:08

Jingguo Yao


1 Answers

BootRun task extends JavaExec task: https://docs.spring.io/spring-boot/docs/2.0.4.RELEASE/gradle-plugin/api/org/springframework/boot/gradle/tasks/run/BootRun.html

Since Gradle 4.9, the command line arguments can be passed with --args. For example, if you want to launch the application with command line arguments foo --bar, you can use:

gradle bootRun --args='--spring.config.name=myproject'
like image 173
jreznot Avatar answered Sep 20 '22 01:09

jreznot