This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch gh-12288-lrm-profile-properties in repository https://gitbox.apache.org/repos/asf/maven.git
commit b32ef7c9c3d334c84c190d97ac121528b1829fc5 Author: Guillaume Nodet <[email protected]> AuthorDate: Wed Jun 17 15:08:10 2026 +0000 Address review feedback: fix activeByDefault deactivation and rename IT - Replace redundant request.getActiveProfiles() call with inactive profile collection so -P !profileId properly excludes activeByDefault profiles - Rename IT class to MavenITgh12288... following project naming convention --- .../aether/DefaultRepositorySystemSessionFactory.java | 12 +++++++----- ...> MavenITgh12288SettingsProfileAetherPropertiesTest.java} | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) 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 57a5210e19..aff1423b9c 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,14 +433,16 @@ 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()); + // Profiles explicitly deactivated via -P !id must be excluded even if they + // declare activeByDefault=true. + HashSet<String> inactiveProfileId = + new HashSet<>(request.getProfileActivation().getRequiredInactiveProfileIds()); + inactiveProfileId.addAll(request.getProfileActivation().getOptionalInactiveProfileIds()); return request.getProfiles().stream() .filter(profile -> activeProfileId.contains(profile.getId()) - || (profile.getActivation() != null + || (!inactiveProfileId.contains(profile.getId()) + && profile.getActivation() != null && profile.getActivation().isActiveByDefault())) .map(ModelBase::getProperties) .flatMap(properties -> properties.entrySet().stream()) diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITSettingsProfileAetherPropertiesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh12288SettingsProfileAetherPropertiesTest.java similarity index 97% rename from its/core-it-suite/src/test/java/org/apache/maven/it/MavenITSettingsProfileAetherPropertiesTest.java rename to its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh12288SettingsProfileAetherPropertiesTest.java index 559574ae54..df89e3c790 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITSettingsProfileAetherPropertiesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh12288SettingsProfileAetherPropertiesTest.java @@ -53,7 +53,7 @@ * settings.xml activation channels fail, which is what these tests guard * against. */ -public class MavenITSettingsProfileAetherPropertiesTest extends AbstractMavenIntegrationTestCase { +public class MavenITgh12288SettingsProfileAetherPropertiesTest extends AbstractMavenIntegrationTestCase { @Test public void testActiveByDefaultProfile() throws Exception {
