From b210d0680a437c3645969f2ad688186d9ef86b5e Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 16 Oct 2020 10:34:58 +0200 Subject: [PATCH 1/2] Polish --- .../spring-boot-maven-plugin/src/docs/asciidoc/build-info.adoc | 3 ++- .../src/docs/asciidoc/packaging-oci-image.adoc | 2 +- .../spring-boot-maven-plugin/src/docs/asciidoc/running.adoc | 3 ++- .../spring-boot-maven-plugin/src/docs/asciidoc/using.adoc | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/build-info.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/build-info.adoc index c8834f4e79..972a96bc74 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/build-info.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/build-info.adoc @@ -35,7 +35,8 @@ It also allows you to add an arbitrary number of additional properties, as shown ---- This configuration will generate a `build-info.properties` at the expected location with four additional keys. -Note that `maven.compiler.source` and `maven.compiler.target` are expected to be regular properties available in the project. + +NOTE: `maven.compiler.source` and `maven.compiler.target` are expected to be regular properties available in the project. They will be interpolated as you would expect. include::goals/build-info.adoc[leveloffset=+1] diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc index fb4d31a966..44340077a9 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc @@ -239,7 +239,7 @@ You can take control over the name, as shown in the following example: ---- -Note that this configuration does not provide an explicit tag so `latest` is used. +NOTE: This configuration does not provide an explicit tag so `latest` is used. It is possible to specify a tag as well, either using `${project.version}`, any property available in the build or a hardcoded version. The image name can be specified on the command line as well, as shown in this example: diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/running.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/running.adoc index e8bf416570..8fda0bc7cb 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/running.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/running.adoc @@ -77,7 +77,8 @@ For more details, see <` tags for those dependencies * Sensible plugin configuration (https://github.com/ktoso/maven-git-commit-id-plugin[Git commit ID], and https://maven.apache.org/plugins/maven-shade-plugin/[shade]). * Sensible resource filtering for `application.properties` and `application.yml` including profile-specific files (for example, `application-dev.properties` and `application-dev.yml`) -Note that, since the `application.properties` and `application.yml` files accept Spring style placeholders (`${...}`), the Maven filtering is changed to use `@..@` placeholders. +NOTE: Since the `application.properties` and `application.yml` files accept Spring style placeholders (`${...}`), the Maven filtering is changed to use `@..@` placeholders. (You can override that by setting a Maven property called `resource.delimiter`.) From 6beb0c939fd5c83bbffa0e77e6c36be3db6bee71 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 16 Oct 2020 10:57:30 +0200 Subject: [PATCH 2/2] 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 +----