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 dea3f7fd08..eda3f3e91c 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 @@ -8,6 +8,8 @@ The plugin includes a run goal which can be used to launch your application from $ mvn spring-boot:run ---- +Application arguments can be specified using the `arguments` parameter, see <> for more details. + By default the application is executed in a forked process and setting properties on the command-line will not affect the application. If you need to specify some JVM arguments (i.e. for debugging purposes), you can use the `jvmArguments` parameter, see <> for more details. There is also explicit support for <> and <>. @@ -205,6 +207,43 @@ Environment variables defined this way take precedence over existing values. +[[run-example-application-arguments]] +==== Using Application Arguments +Application arguments can be specified using the `arguments` attribute. +The following example sets two arguments: `property1` and `property2=42`: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + + org.springframework.boot + spring-boot-maven-plugin + {gradle-project-version} + + + property1 + property2=${my.value} + + + + + + +---- + +On the command-line, arguments are separated by a space the same way `jvmArguments` are. +If an argument contains a space, make sure to quote it. +In the following example, two arguments are available: `property1` and `property2=Hello World`: + +[indent=0] +---- + $ mvn spring-boot:run -Dspring-boot.run.arguments="property1 'property2=Hello World'" +---- + + + [[run-example-active-profiles]] ==== Specify Active Profiles The active profiles to use for a particular application can be specified using the `profiles` argument. diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java index d02c77aee9..68b572691b 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java @@ -155,7 +155,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { * quotes. When specified, takes precedence over {@link #arguments}. * @since 2.2.3 */ - @Parameter(property = "spring-boot.run.arguments", readonly = true) + @Parameter(property = "spring-boot.run.arguments") private String commandlineArguments; /**