From 6beb0c939fd5c83bbffa0e77e6c36be3db6bee71 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 16 Oct 2020 10:57:30 +0200 Subject: [PATCH] Document how to override plugin configuration on the command line Closes gh-21536 --- .../src/docs/asciidoc/using.adoc | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc index 9608da447e..210ad344d7 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/using.adoc @@ -106,3 +106,45 @@ For instance, to use a different version of the SLF4J library and the Spring Dat ---- + +[[using-overriding-command-line]] +=== Overriding settings on the command-line +The plugin offers a number of user properties, starting with `spring-boot`, to let you customize the configuration from the command-line. + +For instance, you could tune the profiles to enable when running the application as follows: + +[indent=0] +---- + $ mvn spring-boot:run -Dspring-boot.run.profiles=dev,local +---- + +If you want to both have a default while allowing it to be overridden on the command-line, you should use a combination of a user-provided project property and MOJO configuration. + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + local,dev + + + + + org.springframework.boot + spring-boot-maven-plugin + {gradle-project-version} + + ${app.profiles} + + + + + +---- + +The above makes sure that `local` and `dev` are enabled by default. +Now a dedicated property has been exposed, this can be overridden on the command-line as well: + +[indent=0] +---- + $ mvn spring-boot:run -Dapp.profiles=test +----