Tarun4201 commented on PR #13406:
URL: https://github.com/apache/maven/pull/13406#issuecomment-6109022667

   ### Summary
   Implements profile-scoped property resolution (`${profile.<id>.<property>}`) 
for issue [MNG-6885](https://issues.apache.org/jira/browse/MNG-6885).
   
   When multiple active profiles define properties with the same name, standard 
Maven profile injection applies last-write-wins to unscoped properties. This PR 
injects scoped properties under the `profile.<id>.<key>` namespace for all 
active profiles into the model via `DefaultProfileInjector` in `maven-impl`, 
allowing POM expressions to reference specific profile values without 
collisions.
   
   ### Key Changes
   - **Scoped Property Injection**: In `DefaultProfileInjector` (`impl`), 
injects properties under `profile.<id>.<key>` when merging active profiles into 
the model.
   - **Source Location Tracking**: Preserves each property's original 
`InputLocation` nested within the model's `"properties"` location map, ensuring 
locations persist across inheritance assembly.
   - **Collision Handling & Precedence**: If a profile-scoped key overrides a 
user-declared model property, a `WARN` log is emitted. Profile IDs containing 
dots apply documented last-write-wins injection order.
   - **Scope Isolation**: Inactive profiles are not injected into model 
properties.
   - **Prefix Exclusion Rule**: Keys already starting with `profile.` are 
skipped to avoid redundant double-scoping.
   - **Documentation**: Added documentation section in `configuring.md` and 
detailed Javadocs in `ProfileInjector` and `DefaultProfileInjector`.
   - **Testing**: Comprehensive unit tests in `ProfileScopePropertiesTest` 
(covering collision resolution, explicit property overrides, nested input 
locations, and edge cases) and a Maven Core IT in `its/core-it-suite/` 
(`MavenITmng6885ProfileScopedPropertiesTest`).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to