You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "ascheman (via GitHub)" <gi...@apache.org> on 2026/06/22 09:55:08 UTC
[PR] [#12288] Backport ITs for settings.xml profile -> LRM property propagation [maven-integration-testing]
ascheman opened a new pull request, #428:
URL: https://github.com/apache/maven-integration-testing/pull/428
@gnodet — for review. Companion to apache/maven#12333 (which backports
the core fix from #12297 / #12298 to the maven-3.10.x line).
## What this PR adds
Three integration tests in
`MavenITgh12288SettingsProfileAetherPropertiesTest`:
* `testActiveByDefaultProfile` — guards that a settings.xml profile
activated via `<activation><activeByDefault>true</activeByDefault>`
has its `<properties>` (notably `aether.*`) propagated to the resolver
session config in time for LRM init.
* `testActiveProfilesList` — guards the
`<activeProfiles><activeProfile>...</activeProfile></activeProfiles>`
channel that already worked on 3.x. Acts as a regression guard so the
channel keeps working after the activeByDefault fix.
* `testActiveByDefaultDeactivatedViaCli` — guards that `-P !profileId`
still deactivates an `<activeByDefault>` profile after the fix, so its
`<properties>` are NOT merged into the resolver session config.
All three tests use the same fixture artifact
(`org.apache.maven.its.settings.profile.aether:test-artifact:1.0:pom`)
and assert the install location under
`<localRepo>/it-custom-prefix/...` — the place
`aether.enhancedLocalRepository.localPrefix` would land it iff the
properties reach the session config.
## Adaptations from master
Equivalent ITs on apache/maven master were merged via #12297 and #12298.
Ported with the following 3.x conventions:
* `java.io.File` API instead of `java.nio.file.Path`
* `Verifier` from `org.apache.maven.shared.verifier` (3.x package)
* `ResourceExtractor.simpleExtractResources` for fixture extraction
* JUnit-4-style assertions inherited from
`AbstractMavenIntegrationTestCase`
* Resource directory uses 3.x `gh-NNNN` naming convention
* `super("[3.10.0-SNAPSHOT,)")` so the IT only runs once the core
backport (apache/maven#12333) lands
## CI behaviour
Until apache/maven#12333 is merged and a Maven 3.10.0 build with the fix
is what the IT-suite runs against, the IT will be **skipped** by the
version-range constraint — green-by-skip is the expected state for now.
## Master origin commits
* apache/maven `7725eaf25ab2715b26848fa56d3f0416862e83cb` — initial 2 ITs
* apache/maven `578523519a33a78a651c472bb07d312e01b1e521` — rename + review hardening
* apache/maven `22f9a0ee086a464f2bfa757ecd0a32053f3d1e8d` — squashed merge of #12298 (added `testActiveByDefaultDeactivatedViaCli`)
References apache/maven#12288, apache/maven#12333.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12288] Backport ITs for settings.xml profile -> LRM property propagation [maven-integration-testing]
Posted by "ascheman (via GitHub)" <gi...@apache.org>.
ascheman commented on code in PR #428:
URL: https://github.com/apache/maven-integration-testing/pull/428#discussion_r3459660815
##########
core-it-suite/src/test/java/org/apache/maven/it/MavenITgh12288SettingsProfileAetherPropertiesTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * 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.it;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Comparator;
+
+import org.apache.maven.shared.verifier.Verifier;
+import org.apache.maven.shared.verifier.util.ResourceExtractor;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Integration tests proving that {@code aether.*} properties declared in the
+ * {@code <properties>} block of a {@code settings.xml} profile are honored
+ * by the resolver at local repository manager initialization, regardless of
+ * which settings.xml-only activation channel was used.
+ *
+ * <p>Two activation channels are covered:
+ * <ul>
+ * <li>{@code <activation><activeByDefault>true</activeByDefault></activation>}
+ * on the profile itself;</li>
+ * <li>{@code <activeProfiles><activeProfile>...</activeProfile></activeProfiles>}
+ * at the top of {@code settings.xml}.</li>
+ * </ul>
+ *
+ * <p>In both cases the same profile sets:
+ * <pre>
+ * aether.enhancedLocalRepository.split = true
+ * aether.enhancedLocalRepository.localPrefix = it-custom-prefix
+ * </pre>
+ * and the test asserts that {@code mvn install} writes the installed pom
+ * under {@code <localRepo>/it-custom-prefix/<groupId-path>/...} rather
+ * than the flat or default-split layout.
+ *
+ * <p>A third test ({@code testActiveByDefaultDeactivatedViaCli}) guards
+ * that {@code -P !profileId} still deactivates an {@code <activeByDefault>}
+ * profile, so its {@code <properties>} are NOT merged into the resolver
+ * session config.
+ *
+ * <p>Backport target: requires the fix from apache/maven PR #12333 to be
+ * present in the running Maven 3.10.x build.
+ */
+public class MavenITgh12288SettingsProfileAetherPropertiesTest extends AbstractMavenIntegrationTestCase {
+
+ public MavenITgh12288SettingsProfileAetherPropertiesTest() {
+ super("[3.10.0-SNAPSHOT,)");
+ }
+
+ @Test
+ public void testActiveByDefaultProfile() throws Exception {
+ runAndAssertCustomPrefix("settings-active-by-default.xml");
+ }
+
+ @Test
+ public void testActiveProfilesList() throws Exception {
+ runAndAssertCustomPrefix("settings-active-profiles-list.xml");
+ }
+
+ @Test
+ public void testActiveByDefaultDeactivatedViaCli() throws Exception {
+ File testDir = ResourceExtractor.simpleExtractResources(
+ getClass(), "/gh-12288-settings-profile-aether-properties");
+
+ Verifier verifier = newVerifier(testDir.getAbsolutePath());
+ verifier.setAutoclean(false);
+ verifier.setLogFileName("log-deactivation.txt");
+ verifier.deleteDirectory("target");
+ verifier.deleteArtifacts("org.apache.maven.its.settings.profile.aether");
+
+ File customPrefixSubtree = new File(verifier.getLocalRepository(), "it-custom-prefix");
+ deleteRecursivelyIfExists(customPrefixSubtree);
+
+ verifier.addCliArgument("--settings");
+ verifier.addCliArgument("settings-active-by-default.xml");
+ verifier.addCliArgument("-P!aether-split-via-settings");
+ verifier.addCliArgument("install");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+
+ String localRepo = verifier.getLocalRepository();
+ String gavRelativePath = "org/apache/maven/its/settings/profile/aether/test-artifact/1.0/test-artifact-1.0.pom";
+ File flatLayout = new File(localRepo, gavRelativePath);
+ File customPrefix = new File(localRepo, "it-custom-prefix/" + gavRelativePath);
+
+ assertTrue(
+ "Expected artifact at flat layout (profile deactivated via -P !), but not found at " + flatLayout,
+ flatLayout.exists());
+
+ assertFalse(
+ "Found artifact at custom prefix " + customPrefix + " - deactivation via -P ! was ignored.",
+ customPrefix.exists());
+ }
+
+ private void runAndAssertCustomPrefix(String settingsFile) throws Exception {
+ File testDir = ResourceExtractor.simpleExtractResources(
+ getClass(), "/gh-12288-settings-profile-aether-properties");
+
+ Verifier verifier = newVerifier(testDir.getAbsolutePath());
+ verifier.setAutoclean(false);
+ verifier.deleteDirectory("target");
Review Comment:
Both items addressed in a2f8f8af9:
* `mvn spotless:apply` straightened out the line wrapping in `MavenITgh12288SettingsProfileAetherPropertiesTest` and the fixture `pom.xml` `<description>`.
* `TestSuiteOrdering` now registers `MavenITgh12288SettingsProfileAetherPropertiesTest`.
Thanks for the courtesy patch — applied verbatim for the IT-class formatting bit (`git apply`) and let `spotless:apply` handle the `pom.xml` description rewrap. CI green across the matrix.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12288] Backport ITs for settings.xml profile -> LRM property propagation [maven-integration-testing]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #428:
URL: https://github.com/apache/maven-integration-testing/pull/428#issuecomment-4776692485
_Claude Code on behalf of Guillaume Nodet_
Here's a patch for the two issues flagged in the review. You can apply it with `git apply`:
<details>
<summary>Patch: Fix Spotless formatting and add TestSuiteOrdering registration</summary>
```diff
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh12288SettingsProfileAetherPropertiesTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh12288SettingsProfileAetherPropertiesTest.java
index c262829e5..50471617f 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh12288SettingsProfileAetherPropertiesTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh12288SettingsProfileAetherPropertiesTest.java
@@ -77,8 +77,8 @@ public class MavenITgh12288SettingsProfileAetherPropertiesTest extends AbstractM
@Test
public void testActiveByDefaultDeactivatedViaCli() throws Exception {
- File testDir = ResourceExtractor.simpleExtractResources(
- getClass(), "/gh-12288-settings-profile-aether-properties");
+ File testDir =
+ ResourceExtractor.simpleExtractResources(getClass(), "/gh-12288-settings-profile-aether-properties");
Verifier verifier = newVerifier(testDir.getAbsolutePath());
verifier.setAutoclean(false);
@@ -111,8 +111,8 @@ public class MavenITgh12288SettingsProfileAetherPropertiesTest extends AbstractM
}
private void runAndAssertCustomPrefix(String settingsFile) throws Exception {
- File testDir = ResourceExtractor.simpleExtractResources(
- getClass(), "/gh-12288-settings-profile-aether-properties");
+ File testDir =
+ ResourceExtractor.simpleExtractResources(getClass(), "/gh-12288-settings-profile-aether-properties");
Verifier verifier = newVerifier(testDir.getAbsolutePath());
verifier.setAutoclean(false);
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java b/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
index c9bd8e395..8acd0b027 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
@@ -121,6 +121,7 @@ public class TestSuiteOrdering implements ClassOrderer {
* a fail fast technique as well.
*/
+ suite.addTestSuite(MavenITgh12288SettingsProfileAetherPropertiesTest.class);
suite.addTestSuite(MavenITgh10312TerminallyDeprecatedMethodInGuiceTest.class);
suite.addTestSuite(MavenITgh10937QuotedPipesInMavenOptsTest.class);
suite.addTestSuite(MavenITmng8106OverlappingDirectoryRolesTest.class);
```
</details>
Alternatively, run `mvn spotless:apply -pl core-it-suite` for the formatting fix and manually add the `TestSuiteOrdering` line.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12288] Backport ITs for settings.xml profile -> LRM property propagation [maven-integration-testing]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #428:
URL: https://github.com/apache/maven-integration-testing/pull/428
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#12288] Backport ITs for settings.xml profile -> LRM property propagation [maven-integration-testing]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on code in PR #428:
URL: https://github.com/apache/maven-integration-testing/pull/428#discussion_r3457469690
##########
core-it-suite/src/test/java/org/apache/maven/it/MavenITgh12288SettingsProfileAetherPropertiesTest.java:
##########
@@ -0,0 +1,168 @@
+/*
+ * 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.it;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Comparator;
+
+import org.apache.maven.shared.verifier.Verifier;
+import org.apache.maven.shared.verifier.util.ResourceExtractor;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Integration tests proving that {@code aether.*} properties declared in the
+ * {@code <properties>} block of a {@code settings.xml} profile are honored
+ * by the resolver at local repository manager initialization, regardless of
+ * which settings.xml-only activation channel was used.
+ *
+ * <p>Two activation channels are covered:
+ * <ul>
+ * <li>{@code <activation><activeByDefault>true</activeByDefault></activation>}
+ * on the profile itself;</li>
+ * <li>{@code <activeProfiles><activeProfile>...</activeProfile></activeProfiles>}
+ * at the top of {@code settings.xml}.</li>
+ * </ul>
+ *
+ * <p>In both cases the same profile sets:
+ * <pre>
+ * aether.enhancedLocalRepository.split = true
+ * aether.enhancedLocalRepository.localPrefix = it-custom-prefix
+ * </pre>
+ * and the test asserts that {@code mvn install} writes the installed pom
+ * under {@code <localRepo>/it-custom-prefix/<groupId-path>/...} rather
+ * than the flat or default-split layout.
+ *
+ * <p>A third test ({@code testActiveByDefaultDeactivatedViaCli}) guards
+ * that {@code -P !profileId} still deactivates an {@code <activeByDefault>}
+ * profile, so its {@code <properties>} are NOT merged into the resolver
+ * session config.
+ *
+ * <p>Backport target: requires the fix from apache/maven PR #12333 to be
+ * present in the running Maven 3.10.x build.
+ */
+public class MavenITgh12288SettingsProfileAetherPropertiesTest extends AbstractMavenIntegrationTestCase {
+
+ public MavenITgh12288SettingsProfileAetherPropertiesTest() {
+ super("[3.10.0-SNAPSHOT,)");
+ }
+
+ @Test
+ public void testActiveByDefaultProfile() throws Exception {
+ runAndAssertCustomPrefix("settings-active-by-default.xml");
+ }
+
+ @Test
+ public void testActiveProfilesList() throws Exception {
+ runAndAssertCustomPrefix("settings-active-profiles-list.xml");
+ }
+
+ @Test
+ public void testActiveByDefaultDeactivatedViaCli() throws Exception {
+ File testDir = ResourceExtractor.simpleExtractResources(
+ getClass(), "/gh-12288-settings-profile-aether-properties");
+
+ Verifier verifier = newVerifier(testDir.getAbsolutePath());
+ verifier.setAutoclean(false);
+ verifier.setLogFileName("log-deactivation.txt");
+ verifier.deleteDirectory("target");
+ verifier.deleteArtifacts("org.apache.maven.its.settings.profile.aether");
+
+ File customPrefixSubtree = new File(verifier.getLocalRepository(), "it-custom-prefix");
+ deleteRecursivelyIfExists(customPrefixSubtree);
+
+ verifier.addCliArgument("--settings");
+ verifier.addCliArgument("settings-active-by-default.xml");
+ verifier.addCliArgument("-P!aether-split-via-settings");
+ verifier.addCliArgument("install");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+
+ String localRepo = verifier.getLocalRepository();
+ String gavRelativePath = "org/apache/maven/its/settings/profile/aether/test-artifact/1.0/test-artifact-1.0.pom";
+ File flatLayout = new File(localRepo, gavRelativePath);
+ File customPrefix = new File(localRepo, "it-custom-prefix/" + gavRelativePath);
+
+ assertTrue(
+ "Expected artifact at flat layout (profile deactivated via -P !), but not found at " + flatLayout,
+ flatLayout.exists());
+
+ assertFalse(
+ "Found artifact at custom prefix " + customPrefix + " - deactivation via -P ! was ignored.",
+ customPrefix.exists());
+ }
+
+ private void runAndAssertCustomPrefix(String settingsFile) throws Exception {
+ File testDir = ResourceExtractor.simpleExtractResources(
+ getClass(), "/gh-12288-settings-profile-aether-properties");
+
+ Verifier verifier = newVerifier(testDir.getAbsolutePath());
+ verifier.setAutoclean(false);
+ verifier.deleteDirectory("target");
Review Comment:
Spotless expects different line wrapping here. CI shows the expected format is:
```suggestion
File testDir =
ResourceExtractor.simpleExtractResources(getClass(), "/gh-12288-settings-profile-aether-properties");
```
Running `mvn spotless:apply` will fix this and the other violation automatically.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org