gnodet commented on code in PR #1774:
URL: https://github.com/apache/maven/pull/1774#discussion_r4291705594


##########
impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionProfileActivator.java:
##########
@@ -182,16 +182,23 @@ static String doGetProperty(ProfileActivationContext 
context, String name) {
 
         // Check user properties
         String v = context.getUserProperty(name);
-        if (v == null) {
-            // Check project properties
-            // TODO: this may leads to instability between file model 
activation and effective model activation
-            //       as the effective model properties may be different from 
the file model
-            v = context.getModelProperty(name);
-        }
         if (v == null) {
             // Check system properties
             v = context.getSystemProperty(name);
         }
+        if (v == null) {
+            // Check project properties (with cascading support if available)
+            // ONLY for POM profiles - settings profiles should not use model 
properties
+            // TODO: this may leads to instability between file model 
activation and effective model activation
+            //       as the effective model properties may be different from 
the file model
+            if (Profile.SOURCE_POM.equals(profile.getSource())) {
+                if (context instanceof 
org.apache.maven.impl.model.DefaultProfileActivationContext dctx) {
+                    v = dctx.getModelPropertyForActivation(name);

Review Comment:
   _Claude Code on behalf of Guillaume Nodet_
   
   Fixed — added a `profile != null` guard before `profile.getSource()` in 
`doGetProperty`. This prevents the latent NPE when `ConditionParserTest` passes 
`null` as the profile.



##########
impl/maven-core/src/test/resources-project-builder/cascading-profile-activation/pom.xml:
##########
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>

Review Comment:
   _Claude Code on behalf of Guillaume Nodet_
   
   Removed the orphaned test resource. The cascading activation feature is 
covered by `DefaultProfileSelectorTest` in `impl/maven-impl`.



-- 
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