Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to override attributes already specified in Maven plugin configuration #21536

Closed
stefano-salmaso opened this issue May 21, 2020 · 6 comments
Assignees
Labels
type: documentation A documentation update
Milestone

Comments

@stefano-salmaso
Copy link

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!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 21, 2020
@scottfrederick
Copy link
Contributor

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

@scottfrederick scottfrederick added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels May 21, 2020
@stefano-salmaso
Copy link
Author

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

@scottfrederick
Copy link
Contributor

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.

@scottfrederick scottfrederick added type: documentation A documentation update and removed status: invalid An issue that we don't feel is valid labels May 22, 2020
@scottfrederick scottfrederick added this to the 2.2.x milestone May 22, 2020
@snicoll snicoll modified the milestones: 2.2.x, 2.3.x Sep 9, 2020
@snicoll
Copy link
Member

snicoll commented Sep 9, 2020

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.

@snicoll snicoll added the for: team-attention An issue we'd like other members of the team to review label Sep 9, 2020
@wilkinsona
Copy link
Member

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?

@wilkinsona
Copy link
Member

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

@wilkinsona wilkinsona removed the for: team-attention An issue we'd like other members of the team to review label Oct 12, 2020
@snicoll snicoll self-assigned this Oct 16, 2020
@snicoll snicoll modified the milestones: 2.3.x, 2.3.5 Oct 16, 2020
@snicoll snicoll changed the title Command line arguments ignored if already specified in Maven plugin configuration Document how to override attributes already specified in Maven plugin configuration Oct 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

5 participants