harshab054 commented on issue #10236:
URL: https://github.com/apache/maven/issues/10236#issuecomment-6449548171
Hi @gnodet and Maven maintainers,
I investigated the current Maven 4 model-building flow for MNG-8392 to
understand where deferred profile evaluation could fit.
Current implementation
- In "DefaultModelBuilder.ParentModelFrame.advance()", active parent
profiles are evaluated and injected into the parent model, after which
".withProfiles(List.of())" removes the profiles.
- "MavenModelMerger.mergeModel_Profiles()" explicitly suppresses profile
inheritance, noting that parent profiles are processed before inheritance
assembly.
- In "readEffectiveModel()", profiles remaining after inheritance assembly
are evaluated in the current project's activation context. Today, these are the
child's local profiles.
- Parent model caching uses activation-context records to determine whether
a cached parent model can be reused. Deferring child-specific profile
evaluation could reduce cache fragmentation, although the actual benefit would
depend on the other activation conditions involved.
These behaviors appear relevant to the use case described in MNG-5127, where
a parent profile needs to be evaluated in a child project's context.
Questions about the intended design
Before exploring an implementation, could you clarify a few semantic choices?
1. POM 4.1.0 representation: Would you prefer an explicit evaluation mode
such as "<evaluation>lazy</evaluation>", an inheritance flag, or another
mechanism? The distinction should preserve existing eager-profile behavior by
default.
2. Intermediate parents: For a Grandparent → Parent ("pom" packaging) →
Child hierarchy, should deferred profiles be evaluated at every inheritance
level or remain deferred until the consuming child? If evaluated at
intermediate levels, how should we prevent duplicate injection of additive
configuration, as covered by MNG-4023?
3. Profile ID collisions: If a child declares a profile with the same ID as
an inherited deferred profile, should the child definition replace the parent
definition or should their contents merge?
4. CLI activation: If a profile is selected through "-P", should an
inherited deferred profile activate in every inheriting project, or should its
other activation conditions still determine where it applies?
I have not started implementation work; I'd appreciate guidance on the
intended semantics before proposing a patch.
Thank you!
--
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]