From 765b2178d17d6abe1dd67c6e786ec80297ee8b75 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 11 Feb 2020 13:39:10 +0100 Subject: [PATCH] Document spring-boot.run.arguments behaviour with multiple arguments Closes gh-19998 --- .../boot/maven/AbstractRunMojo.java | 4 +- .../site/apt/examples/run-arguments.apt.vm | 51 +++++++++++++++++++ .../src/site/apt/index.apt | 2 + .../src/site/site.xml | 1 + 4 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-arguments.apt.vm 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 b76a6e95883..98f53deac00 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 @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -145,7 +145,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; /** diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-arguments.apt.vm b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-arguments.apt.vm new file mode 100644 index 00000000000..9569519dc88 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-arguments.apt.vm @@ -0,0 +1,51 @@ + ----- + Using Application Arguments + ----- + Stephane Nicoll + ----- + 2020-02-11 + ----- + + Application arguments can be specified using <<>>. The following sets two + arguments: <<>> and <<>>: + +--- + + ... + + + 42 + + ... + + ... + + ${project.groupId} + ${project.artifactId} + ${project.version} + + + property1 + property2=${my.value} + + + ... + + ... + + ... + + ... + +--- + + On the command-line, arguments are separated by a space the same way <<>> + are. If an argument contains a space, make sure to quote it. In the following example, + two arguments are available: <<>> and <<>>: + +--- +mvn spring-boot:run -Dspring-boot.run.arguments="property1 'property2=Hello World'" +--- + + + diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt index 64cd7a049a6..7058998d72b 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt @@ -58,6 +58,8 @@ Spring Boot Maven Plugin * {{{./examples/run-env-variables.html}Using environment variables}} + * {{{./examples/run-arguments.html}Using application arguments}} + * {{{./examples/it-random-port.html}Random port for integration tests}} * {{{./examples/it-skip.html}Skip integration tests}} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml index 6711b55c15c..11084a6fdb2 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml @@ -14,6 +14,7 @@ +