gnodet-bot commented on code in PR #13155:
URL: https://github.com/apache/maven/pull/13155#discussion_r4026019157


##########
impl/maven-impl/src/test/resources/poms/factory/active-by-default-profile.xml:
##########
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!---
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.1.0";>
+    <groupId>org.apache.maven.tests</groupId>

Review Comment:
   For consistency with the rest of the `poms/factory/` fixtures and with how 
the impl test references this artifact, consider using `org.apache.maven.test` 
(without the trailing `s`) — or conversely, update the `resolvedSource` call to 
say `org.apache.maven.tests`. Either is fine; they just need to match.



##########
impl/maven-impl/src/test/java/org/apache/maven/impl/model/DefaultModelBuilderTest.java:
##########
@@ -172,7 +172,32 @@ public void 
testDependencyModelActivatesOnlyEnvironmentIndependentProfiles() {
         assertNull(model.getProperties().get("profile.property"));
         assertNull(model.getProperties().get("profile.condition"));
         assertEquals("activated", model.getProperties().get("profile.jdk"));
-        assertTrue(model.getRepositories().stream().noneMatch(r -> 
"profile-repo".equals(r.getId())));
+        // Repositories from legitimately-active profiles (JDK-activated) must 
be honored.
+        // See #13100, #13141.
+        assertTrue(model.getRepositories().stream().anyMatch(r -> 
"profile-repo".equals(r.getId())));
+    }
+
+    /**
+     * An {@code activeByDefault=true} profile in an external dependency model 
must contribute
+     * its repositories — the same guarantee as for JDK/OS-activated profiles 
(see #13100).
+     * Uses a dedicated fixture with only an activeByDefault profile so the 
standard Maven rule
+     * ("activeByDefault is suppressed when any other profile activates") does 
not interfere.
+     */
+    @Test
+    public void testActiveByDefaultProfileRepositoryHonored() {
+        ModelBuilderRequest request = ModelBuilderRequest.builder()
+                .session(session)
+                
.requestType(ModelBuilderRequest.RequestType.CONSUMER_DEPENDENCY)
+                .source(Sources.resolvedSource(
+                        getPom("active-by-default-profile"), 
"org.apache.maven.test:active-by-default-profile:1.0.0"))

Review Comment:
   ⚠️ **GAV typo:** `org.apache.maven.test` (singular) does not match the 
fixture's `<groupId>org.apache.maven.tests</groupId>` (plural). The coordinate 
hint passed to `resolvedSource` does not drive profile selection, so the test 
still passes — but readers will be confused when they cross-reference the 
fixture. Please fix to 
`"org.apache.maven.tests:active-by-default-profile:1.0.0"`.
   
   ```suggestion
                           getPom("active-by-default-profile"), 
"org.apache.maven.tests:active-by-default-profile:1.0.0"))
   ```



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