mnk opened a new pull request, #13331: URL: https://github.com/apache/maven/pull/13331
Proposed fix for https://github.com/apache/maven/issues/10375 (MNG-8710) Should be backported 4.0, as it is also affected. A parent POM profile activated by <file><exists>${message.file}</exists></file>, where message.file is a parent property, activated for the parent project but was never injected into child modules. When reading a parent for a child, ParentModelFrame activated the parent's profiles against a context derived from the child's pre-inheritance model. That model has the right basedir for per-module file checks but lacks the parent's properties, so ${message.file} did not interpolate and the profile stayed inactive. Maven 3 keeps the child's project directory for the whole lineage walk but sets each ancestor's own properties before activating that ancestor's profiles. Do the same: activate parent profiles in a fresh recording context (new DefaultProfileActivationContext.start(Map)) whose model properties are those of the assembled parent, keeping the child's basedir, packaging and artifactId. The recording context also serves as the parent-model cache key, so it is not mutated in place with setModel(parent): - recorded lookups use computeIfAbsent, so a model property already replayed from a grandparent's record would win over the parent's own value; - Record.matches() checks model properties against the child's model, so parent-derived values would make the cache miss for nearly every child. The activation record is therefore replayed into the outer recording without its model properties (new replayRecordIntoContext overload). This is safe because the parent's assembled properties follow from its source and the ancestor keys already recorded. Exists checks, system/user properties and model infos are all child-derived and are still recorded. Adds a DefaultModelBuilderTest case and core IT MavenITmng8710. To make clear that you license your contribution under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) check one of the following: - [X] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) - [X] I hereby declare that I have filed an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). -- 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]
