Skip to content

Commit 765b217

Browse files
committed
Document spring-boot.run.arguments behaviour with multiple arguments
Closes gh-19998
1 parent 5f58410 commit 765b217

File tree

4 files changed

+56
-2
lines changed

4 files changed

+56
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -145,7 +145,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
145145
* quotes. When specified, takes precedence over {@link #arguments}.
146146
* @since 2.2.3
147147
*/
148-
@Parameter(property = "spring-boot.run.arguments", readonly = true)
148+
@Parameter(property = "spring-boot.run.arguments")
149149
private String commandlineArguments;
150150

151151
/**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
-----
2+
Using Application Arguments
3+
-----
4+
Stephane Nicoll
5+
-----
6+
2020-02-11
7+
-----
8+
9+
Application arguments can be specified using <<<arguments>>>. The following sets two
10+
arguments: <<<property1>>> and <<<property2=42>>>:
11+
12+
---
13+
<project>
14+
...
15+
<build>
16+
<properties>
17+
<my.value>42</my.value>
18+
</properties>
19+
...
20+
<plugins>
21+
...
22+
<plugin>
23+
<groupId>${project.groupId}</groupId>
24+
<artifactId>${project.artifactId}</artifactId>
25+
<version>${project.version}</version>
26+
<configuration>
27+
<arguments>
28+
<argument>property1</argument>
29+
<argument>property2=${my.value}</argument>
30+
</arguments>
31+
</configuration>
32+
...
33+
</plugin>
34+
...
35+
</plugins>
36+
...
37+
</build>
38+
...
39+
</project>
40+
---
41+
42+
On the command-line, arguments are separated by a space the same way <<<jvmArguments>>>
43+
are. If an argument contains a space, make sure to quote it. In the following example,
44+
two arguments are available: <<<property1>>> and <<<property2=Hello World>>>:
45+
46+
---
47+
mvn spring-boot:run -Dspring-boot.run.arguments="property1 'property2=Hello World'"
48+
---
49+
50+
51+

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ Spring Boot Maven Plugin
5858

5959
* {{{./examples/run-env-variables.html}Using environment variables}}
6060

61+
* {{{./examples/run-arguments.html}Using application arguments}}
62+
6163
* {{{./examples/it-random-port.html}Random port for integration tests}}
6264

6365
* {{{./examples/it-skip.html}Skip integration tests}}

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<item name="Debug the application" href="examples/run-debug.html"/>
1515
<item name="Using system properties" href="examples/run-system-properties.html"/>
1616
<item name="Using environment variable" href="examples/run-env-variables.html"/>
17+
<item name="Using application arguments" href="examples/run-arguments.html"/>
1718
<item name="Random port for integration tests" href="examples/it-random-port.html"/>
1819
<item name="Skip integration tests" href="examples/it-skip.html"/>
1920
<item name="Specify active profiles" href="examples/run-profiles.html"/>

0 commit comments

Comments
 (0)