Hi all, I'm facing a problem with spring-boot-maven-plugin and spring-boot version >= 2.2.5-RELEASE. If the plugin configuration has some configuration/arguments/argument, they are not replaced by the command line arguments. This can be reproduced with an application that print the args received.

Having the plugin

<plugin>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-maven-plugin</artifactId>
  <configuration>
    <arguments>
      <argument>property1=xxx</argument>
    </arguments>
  </configuration>
</plugin>

when you run

mvn spring-boot:run

the args are:

property1=xxx

If you run

mvn spring-boot:run -Dspring-boot.run.arguments="property1=yyy"

again the output (wrong) is

property1=xxx

If you do the same with ver 2.2.4-RELEASE everything works fine.

Thanks!

Comment From: scottfrederick

Maven convention is for properties provided in the POM to take precedence over properties provided on the command line. In a few cases like spring-boot.run.arguments and spring-boot.run.jvmArguments where Spring Boot MOJOs has special handling for a property, we had that order reversed. In 2.2.5.RELEASE and later, we changed these two properties to follow the Maven convention to be consistent with all other Spring Boot MOJO properties.

See the discussion that led to this decision in this issue: https://github.com/spring-projects/spring-boot/issues/20024

Comment From: stefano-salmaso

Hi @scottfrederick thanks for your quick reply, I understand! Maybe it could be useful to remark this behavior also in the documentation, for example here: https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/html/#run-example-application-arguments Reading only the documentation it seems that, from the command line, the configurations of the POM can be overwritten. Thanks again

Comment From: scottfrederick

As you probably noticed in the previous issue, we were a bit surprised by this order of precedence ourselves. It would be good to add a note about this in the documentation somewhere and to make sure we don't have any misleading statements. I'll re-open this as a documentation issue to address that.

Comment From: snicoll

I don't think there is a single place where we can write this down that would be discoverable. Looking at our current doc, it feels to me that it is something we'd have to states more than once to be useful and I don't think our doc should explain how Maven works.

My vote is to close this, flagging for team attention to see what the rest of the team thinks.

Comment From: wilkinsona

Perhaps we could mention it in https://docs.spring.io/spring-boot/docs/2.3.3.RELEASE/maven-plugin/reference/html/#using, even if it's just to link to Maven's own documentation on configuration precedence?

Comment From: wilkinsona

We'd like to document the trick that @scottfrederick has described here where you use a project property to make things overridable.