Skip to content

Commit 3229142

Browse files
committed
Merge branch '2.2.x'
Closes gh-20121
2 parents 1306c9b + 765b217 commit 3229142

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/running.adoc

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ The plugin includes a run goal which can be used to launch your application from
88
$ mvn spring-boot:run
99
----
1010

11+
Application arguments can be specified using the `arguments` parameter, see <<run-example-application-arguments,using application arguments>> for more details.
12+
1113
By default the application is executed in a forked process and setting properties on the command-line will not affect the application.
1214
If you need to specify some JVM arguments (i.e. for debugging purposes), you can use the `jvmArguments` parameter, see <<run-example-debug,Debug the application>> for more details.
1315
There is also explicit support for <<run-example-system-properties,system properties>> and <<run-example-environment-variables,environment variables>>.
@@ -205,6 +207,43 @@ Environment variables defined this way take precedence over existing values.
205207

206208

207209

210+
[[run-example-application-arguments]]
211+
==== Using Application Arguments
212+
Application arguments can be specified using the `arguments` attribute.
213+
The following example sets two arguments: `property1` and `property2=42`:
214+
215+
[source,xml,indent=0,subs="verbatim,attributes"]
216+
----
217+
<project>
218+
<build>
219+
<plugins>
220+
<plugin>
221+
<groupId>org.springframework.boot</groupId>
222+
<artifactId>spring-boot-maven-plugin</artifactId>
223+
<version>{gradle-project-version}</version>
224+
<configuration>
225+
<arguments>
226+
<argument>property1</argument>
227+
<argument>property2=${my.value}</argument>
228+
</arguments>
229+
</configuration>
230+
</plugin>
231+
</plugins>
232+
</build>
233+
</project>
234+
----
235+
236+
On the command-line, arguments are separated by a space the same way `jvmArguments` are.
237+
If an argument contains a space, make sure to quote it.
238+
In the following example, two arguments are available: `property1` and `property2=Hello World`:
239+
240+
[indent=0]
241+
----
242+
$ mvn spring-boot:run -Dspring-boot.run.arguments="property1 'property2=Hello World'"
243+
----
244+
245+
246+
208247
[[run-example-active-profiles]]
209248
==== Specify Active Profiles
210249
The active profiles to use for a particular application can be specified using the `profiles` argument.

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
155155
* quotes. When specified, takes precedence over {@link #arguments}.
156156
* @since 2.2.3
157157
*/
158-
@Parameter(property = "spring-boot.run.arguments", readonly = true)
158+
@Parameter(property = "spring-boot.run.arguments")
159159
private String commandlineArguments;
160160

161161
/**

0 commit comments

Comments
 (0)