This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch gnodet/gh-12288-lrm-profile-properties
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 3e2c7560216be837d69ae65ddb625648e8274e7d
Author: Gerd Aschemann <[email protected]>
AuthorDate: Wed Jun 17 12:28:23 2026 +0200

    [#12288] Pass settings.xml profile props to LRM
    
    DefaultRepositorySystemSessionFactory#getPropertiesFromRequestedProfiles
    previously only considered CLI-activated profile ids (-P). Profiles
    activated through settings.xml (<activeProfiles> or <activeByDefault>)
    were filtered out, so any <properties> they declared were dropped
    before the resolver session was built. aether.* configuration was the
    most visible casualty (LRM split/localPrefix etc.), but the gap
    affects every property declared in such a profile.
    
    The fix only touches profile <properties>; other profile content
    (<plugins>, <dependencies>, <repositories>, ...) is unchanged and
    keeps flowing through its existing project/build channels.
    
    Extend the active-profile-id set with request.getActiveProfiles() and
    add an isActiveByDefault() branch to the filter.
    
    Note: this does not re-implement the full DefaultProfileSelector
    semantics (e.g. activeByDefault deactivation when other profiles of
    the same source are active). For the property-propagation use case in
    scope of #12288 this is sufficient; injecting ProfileSelector here
    would be a larger refactor in a session-build hot path and is left to
    a follow-up if needed.
---
 .../internal/aether/DefaultRepositorySystemSessionFactory.java    | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/impl/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java
 
b/impl/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java
index b25171dcec..57a5210e19 100644
--- 
a/impl/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java
+++ 
b/impl/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java
@@ -433,9 +433,15 @@ private Map<String, String> 
getPropertiesFromRequestedProfiles(MavenExecutionReq
         HashSet<String> activeProfileId =
                 new 
HashSet<>(request.getProfileActivation().getRequiredActiveProfileIds());
         
activeProfileId.addAll(request.getProfileActivation().getOptionalActiveProfileIds());
+        // Also include profiles activated via settings.xml <activeProfiles> 
so that their
+        // properties (notably aether.* configuration) reach the resolver 
session config in
+        // time for LocalRepositoryManager initialization.
+        activeProfileId.addAll(request.getActiveProfiles());
 
         return request.getProfiles().stream()
-                .filter(profile -> activeProfileId.contains(profile.getId()))
+                .filter(profile -> activeProfileId.contains(profile.getId())
+                        || (profile.getActivation() != null
+                                && 
profile.getActivation().isActiveByDefault()))
                 .map(ModelBase::getProperties)
                 .flatMap(properties -> properties.entrySet().stream())
                 .filter(e -> e.getValue() != null)

Reply via email to