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


##########
impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultProfileActivationContext.java:
##########
@@ -484,7 +524,7 @@ private String interpolate(String path) throws 
InterpolatorException {
             if ("project.rootDirectory".equals(s)) {
                 return getModelRootDirectory();
             }
-            String r = getModelProperty(s);
+            String r = getModelPropertyForActivation(s);

Review Comment:
   _Claude Code on behalf of Guillaume Nodet_
   
   Fixed — `interpolate()` now uses the correct lookup order: user → system → 
model/cascaded, matching `ConditionProfileActivator.doGetProperty()`.
   
   Also fixed the root cause of the Windows CI failures: explicitly-activated 
profiles (`-P` flag) no longer cascade their properties into subsequent 
activation rounds. Only profiles activated by an activator match 
(property/condition/file/JDK) contribute to the cascade. This prevents the 
`-Prun-its` → `mavenHome` → `maven-from-build` cascade chain that caused the 
antrun step to delete the running Maven installation on Windows.



##########
impl/maven-impl/src/test/java/org/apache/maven/impl/model/DefaultProfileSelectorTest.java:
##########
@@ -0,0 +1,410 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.impl.model;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.api.model.Activation;
+import org.apache.maven.api.model.ActivationProperty;
+import org.apache.maven.api.model.Model;
+import org.apache.maven.api.model.Profile;
+import org.apache.maven.impl.DefaultModelVersionParser;
+import org.apache.maven.impl.model.profile.PropertyProfileActivator;
+import org.apache.maven.impl.model.profile.SimpleProblemCollector;
+import org.apache.maven.impl.model.rootlocator.DefaultRootLocator;
+import org.eclipse.aether.util.version.GenericVersionScheme;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Tests {@link DefaultProfileSelector} with focus on cascading activation 
behavior.
+ */
+public class DefaultProfileSelectorTest {

Review Comment:
   _Claude Code on behalf of Guillaume Nodet_
   
   Added `testExplicitlyActivatedProfileDoesNotCascade()` — reproduces the 
Windows CI failure scenario where `-Prun-its` sets `mavenHome` and verifies it 
does NOT cascade to activate `maven-from-build`.
   
   The `interpolate()` lookup order was also fixed (user → system → model). 
File-existence cascade behavior follows naturally from the interpolation 
resolving model properties, which is pre-existing behavior now with the correct 
precedence. The new test for the explicit-activation fix is the more critical 
regression test here.



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