Skip to content

Commit

Permalink
Document spring-boot.run.arguments behaviour with multiple arguments
Browse files Browse the repository at this point in the history
Closes gh-19998
  • Loading branch information
snicoll committed Feb 11, 2020
1 parent 5f58410 commit 765b217
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
-----
Using Application Arguments
-----
Stephane Nicoll
-----
2020-02-11
-----

Application arguments can be specified using <<<arguments>>>. The following sets two
arguments: <<<property1>>> and <<<property2=42>>>:

---
<project>
...
<build>
<properties>
<my.value>42</my.value>
</properties>
...
<plugins>
...
<plugin>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<configuration>
<arguments>
<argument>property1</argument>
<argument>property2=${my.value}</argument>
</arguments>
</configuration>
...
</plugin>
...
</plugins>
...
</build>
...
</project>
---

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>>>:

---
mvn spring-boot:run -Dspring-boot.run.arguments="property1 'property2=Hello World'"
---



Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<item name="Debug the application" href="examples/run-debug.html"/>
<item name="Using system properties" href="examples/run-system-properties.html"/>
<item name="Using environment variable" href="examples/run-env-variables.html"/>
<item name="Using application arguments" href="examples/run-arguments.html"/>
<item name="Random port for integration tests" href="examples/it-random-port.html"/>
<item name="Skip integration tests" href="examples/it-skip.html"/>
<item name="Specify active profiles" href="examples/run-profiles.html"/>
Expand Down

0 comments on commit 765b217

Please sign in to comment.