quarkus: Devmode, Regression in 1.6.0: Cannot override property from profile via system property
Describe the bug
Overriding a property that is defined in the %dev profile via system property (-D...) does not work anymore.
Expected behavior System property must take precedence (as in 1.5.2 or lower)
Actual behavior Profile in properties/yaml takes precedence.
To Reproduce Steps to reproduce the behavior:
- Clone https://github.com/famod/quarkus-quickstarts
git switch devmode-port-overridecd getting-startedmvn clean verifymvn quarkus:devstarts on port 2081mvn quarkus:dev -Dquarkus.http.port=0(or any other port) still starts on port 2081- remove profile prefix from property or remove entire property in
application.properties mvn quarkus:dev -Dquarkus.http.port=0starts with desired port
Configuration
%dev.quarkus.http.port=2081
Screenshots n/a
Environment (please complete the following information):
- Output of
uname -aorver:MINGW64_NT-10.0-18363 BIGBLUE 3.0.7-338.x86_64 2019-11-21 23:07 UTC x86_64 Msys - Output of
java -version:openjdk version "11.0.7" 2020-04-14 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.7+10) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.7+10, mixed mode) - GraalVM version (if different from Java): n/a
- Quarkus version or git rev: 1.6.0.Final
- Build tool (ie. output of
mvnw --versionorgradlew --version):Apache Maven 3.6.3
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 19 (19 by maintainers)
Commits related to this issue
- Update to SmallRye Config 1.8.4. This should fix #10570 and #10643. — committed to radcortez/quarkus by radcortez 4 years ago
- Update to SmallRye Config 1.8.4. This should fix #10570 and #10643. — committed to gsmet/quarkus by radcortez 4 years ago
I’ve pushed the fix to SmallRye Config and updated Quarkus here: https://github.com/quarkusio/quarkus/pull/10615
Yes as long as the SmallRye Config update is minimal, I’m fine with backporting it to 1.6.1.Final.
Ok, I think the issue relates with #10320 resolution.
Quarkus before 1.6 prioritises properties from higher ordinals even if they are not part of the active profile. The implementation we have was also correct.
What changed was the execution order between resolution of profiles / expansion, leading to the issue in #10320 where a property was being expanded and failing because there was no expanding property. We fixed this by looking only into the profile, but that was actually a wrong fix, because it now introduced the bug described here.
I already have an idea on how to fix this. I’ll send a PR shortly.
And BTW, thanks for reporting and making the case clystal clear