Browse Source

Document spring-boot.run.arguments behaviour with multiple arguments

Closes gh-19998
pull/20222/head
Stephane Nicoll 6 years ago
parent
commit
765b2178d1
  1. 4
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java
  2. 51
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-arguments.apt.vm
  3. 2
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt
  4. 1
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml

4
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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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}. * quotes. When specified, takes precedence over {@link #arguments}.
* @since 2.2.3 * @since 2.2.3
*/ */
@Parameter(property = "spring-boot.run.arguments", readonly = true) @Parameter(property = "spring-boot.run.arguments")
private String commandlineArguments; private String commandlineArguments;
/** /**

51
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 <<<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'"
---

2
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-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-random-port.html}Random port for integration tests}}
* {{{./examples/it-skip.html}Skip integration tests}} * {{{./examples/it-skip.html}Skip integration tests}}

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

@ -14,6 +14,7 @@
<item name="Debug the application" href="examples/run-debug.html"/> <item name="Debug the application" href="examples/run-debug.html"/>
<item name="Using system properties" href="examples/run-system-properties.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 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="Random port for integration tests" href="examples/it-random-port.html"/>
<item name="Skip integration tests" href="examples/it-skip.html"/> <item name="Skip integration tests" href="examples/it-skip.html"/>
<item name="Specify active profiles" href="examples/run-profiles.html"/> <item name="Specify active profiles" href="examples/run-profiles.html"/>

Loading…
Cancel
Save