[MNG-11133] Fix mixin property precedence - mixins should override parent properties #11141
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes MNG-11133 where mixin properties were not overriding properties inherited from the parent.
Problem
Mixins are applied after parent inheritance, but the merge was using
sourceDominant=false
, causing the existing model's properties to win over the mixin's properties. This meant that parent properties would override mixin properties, which is incorrect behavior.For example:
maven.compiler.release=11
maven.compiler.release=21
21
(mixin wins)11
(parent wins)Solution
DefaultInheritanceAssembler
to control source dominance during model inheritancesourceDominant=true
when applying mixins so mixin properties override previously inherited onesChanges
Core Changes
sourceDominant
parametersourceDominant=true
when applying mixins in two places:Test Changes
maven.compiler.release=11
maven.compiler.release=21
21
(mixin wins)Testing
The integration test should fail before the fix and pass after the fix, confirming that the bug is reproduced and resolved.
Backward Compatibility
This change corrects the behavior to match the expected semantics of mixins. While it changes the effective property values in some cases, it aligns with the documented and expected behavior that mixins should override parent properties.
Note: This is a draft PR. The integration test may need the full Maven build to run properly due to dependencies on IT support modules.
Pull Request opened by Augment Code with guidance from the PR author