-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[MNG-8694] Fix version interpolation and ternary operator #2272
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the behavior is complete.
It could be solved by a loop, but preferably by using the DefaultInterpolator service.
impl/maven-core/src/test/resources/projects/pom-parent-version-from-nested-properties/pom.xml
Outdated
Show resolved
Hide resolved
impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java
Outdated
Show resolved
Hide resolved
@gnodet Removed unused regex as well, can you approve again? |
I still think this only partially address the use case from MNG-8694, so IMHO we'd need to extend the test to support a similar use case. Probably not using a profile, since it won't work, but using a value such as |
@gnodet Test case extended |
Thx, I slightly modified it as one of the problem was the generation of an empty string when This PR now fixes the ternary operator to support expressions such as The actual solution for the original use case is to use |
When processing ternary expressions like ${release:+${foo}:-${bar}} or ${versionCore}${release:+-DEVELOPER}, the DefaultInterpolator was incorrectly continuing to process subsequent operators after a decision had been made on the first operator. This fix adds a break statement after each successful operator evaluation to stop processing any remaining operators once a decision has been made, ensuring that: 1. When 'release' is true and 'foo' is empty, correctly evaluates to an empty string 2. When 'release' is true, correctly evaluates to just Added test cases to verify both scenarios.
Resolve #9611 |
Fix for https://issues.apache.org/jira/browse/MNG-8694
@slawekjaranowski as mentioned today on jug challenge accepted!