-
Couldn't load subscription status.
- Fork 41.6k
Description
Description: the spring-boot.run.jvmArguments does not take precedence over the < systemPropertyVariables> map when there is a <jvmArguments> section defined for the spring-boot-maven-plugin.
Documented behavior:
According to the https://docs.spring.io/spring-boot/docs/current/maven-plugin/examples/run-system-properties.html when the spring-boot.run.jvmArguments parameter is provided for the spring-boot:run command the parameter takes precedence and overwrites the system properties defined within the <systemPropertyVariables> XML configuration. I would expect that the presence of the jvmArguments section does not influence the documented behavior.
Steps to reproduce:
There is a sample application which demonstrates non-documented (faulty?) behavior located at https://github.com/rawfg/maven-jvmargs.
-
The sample application prints the system properties starting with the
xyzand by default there are two system properties configured: one comes from the<jvmArguments>section and the other one comes from the< systemPropertyVariables>section. -
When the application is run from the command line via the command:
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dxyz.MavenSystemProperty='cmd-system-property'" the output is (system properties configured in the pom.xml):
xyz.MavenSystemProperty=maven-system-property
xyz.MavenJvmProperty=maven-jvm-property- When the
<jvmArguments>section is commented out the application behaves as it was documented, so running the command:
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dxyz.MavenSystemProperty='cmd-system-property'" results in the output:
xyz.MavenSystemProperty=cmd-system-property- I tested it with the Spring Boot version
2.2.4but I've downgraded to the2.1.7version and I observed the same outcome.
Expected behavior:
-Dspring-boot.run.jvmArgumentsalways works as documented (step 3) or- the exception is documented in the https://docs.spring.io/spring-boot/docs/current/maven-plugin/examples/run-system-properties.html