Skip to content

Unlike all other Maven properties, spring-boot.run.arguments on the command line takes precedence over the pom #20024

@rawfg

Description

@rawfg

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.

  1. The sample application prints the system properties starting with the xyz and by default there are two system properties configured: one comes from the <jvmArguments> section and the other one comes from the < systemPropertyVariables> section.

  2. 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
  1. 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
  1. I tested it with the Spring Boot version 2.2.4 but I've downgraded to the 2.1.7 version and I observed the same outcome.

Expected behavior:

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions