This is an automated email from the ASF dual-hosted git repository. rmannibucau pushed a commit to branch dev/activation-executable-refinements in repository https://gitbox.apache.org/repos/asf/maven.git
commit 436370690da5f132d6cb37f45b6491ee0ed79cbc Author: Romain Manni-Bucau <[email protected]> AuthorDate: Wed Nov 18 21:04:09 2026 +0100 Rename executable activation ITs to the GH-10115 convention --- ...a => MavenITgh10115ExecutableWindowsShellTest.java} | 12 ++++++------ ...venITgh10115ProfileActivationByExecutableTest.java} | 18 +++++++++++------- .../pom.xml | 6 +++--- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8768ExecutableWindowsShellTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh10115ExecutableWindowsShellTest.java similarity index 95% rename from its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8768ExecutableWindowsShellTest.java rename to its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh10115ExecutableWindowsShellTest.java index 98b213e10d..1350e388ca 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8768ExecutableWindowsShellTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh10115ExecutableWindowsShellTest.java @@ -40,8 +40,8 @@ * Optional shell locations can be supplied as JVM properties maven.it.gitBash and maven.it.cygwinBash. */ @EnabledOnOs(OS.WINDOWS) -class MavenITmng8768ExecutableWindowsShellTest extends AbstractMavenIntegrationTestCase { - private static final String COMMAND = "mng8768-profile-tool"; +class MavenITgh10115ExecutableWindowsShellTest extends AbstractMavenIntegrationTestCase { + private static final String COMMAND = "gh10115-profile-tool"; private static final String DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD"; // Written to a temp file to avoid Windows CreateProcess argument-quoting issues // when passing multi-line scripts with double quotes via ProcessBuilder + -c. @@ -100,14 +100,14 @@ private Path findShell(final String property, final Iterable<Path> candidates) { private void verifyShell(final Path shell) throws Exception { verifyActivation(shell, ".cmd", DEFAULT_PATHEXT, true); verifyActivation(shell, ".exe", DEFAULT_PATHEXT, true); - verifyActivation(shell, ".mng8768", DEFAULT_PATHEXT + ";.MNG8768", true); - verifyActivation(shell, ".mng8768", DEFAULT_PATHEXT, false); - verifyActivation(shell, null, DEFAULT_PATHEXT + ";.MNG8768", false); + verifyActivation(shell, ".gh10115", DEFAULT_PATHEXT + ";.GH10115", true); + verifyActivation(shell, ".gh10115", DEFAULT_PATHEXT, false); + verifyActivation(shell, null, DEFAULT_PATHEXT + ";.GH10115", false); } private void verifyActivation(final Path shell, final String suffix, final String pathExt, final boolean active) throws Exception { - final var fixture = extractResources("mng-8768"); + final var fixture = extractResources("gh-10115-profile-activation-by-executable"); final var project = Files.createTempDirectory(fixture, getName() + "-").toAbsolutePath(); // The unique command name avoids collisions with tools installed in the shell's own bin directories. Files.copy(fixture.resolve("pom.xml"), project.resolve("pom.xml")); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8768ProfileActivationByExecutableTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh10115ProfileActivationByExecutableTest.java similarity index 89% rename from its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8768ProfileActivationByExecutableTest.java rename to its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh10115ProfileActivationByExecutableTest.java index 1e9d1dea2e..270106b6f3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8768ProfileActivationByExecutableTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh10115ProfileActivationByExecutableTest.java @@ -35,8 +35,8 @@ /** * Verifies that executable() profile activation searches the forked Maven process's PATH without running the command. */ -class MavenITmng8768ProfileActivationByExecutableTest extends AbstractMavenIntegrationTestCase { - private static final String COMMAND = "mng8768-profile-tool"; +class MavenITgh10115ProfileActivationByExecutableTest extends AbstractMavenIntegrationTestCase { + private static final String COMMAND = "gh10115-profile-tool"; private static final String BIN = "fake bin with spaces"; @Test @@ -88,7 +88,7 @@ void testWindowsCmdSuffix() throws Exception { @EnabledOnOs(OS.WINDOWS) void testWindowsCustomPathExtIsNotUsed() throws Exception { final var project = createProject(); - createFakeExecutable(project, COMMAND + ".MNG8768", true); + createFakeExecutable(project, COMMAND + ".GH10115", true); verifyActivation(project, false); } @@ -96,12 +96,12 @@ void testWindowsCustomPathExtIsNotUsed() throws Exception { @EnabledOnOs(OS.WINDOWS) void testWindowsCustomPathExtIsUsed() throws Exception { final var project = createProject(); - createFakeExecutable(project, COMMAND + ".MNG8768", true); - verifyActivation(project, true, ".EXE;.CMD;.MNG8768"); + createFakeExecutable(project, COMMAND + ".GH10115", true); + verifyActivation(project, true, ".EXE;.CMD;.GH10115"); } private Path createProject() throws Exception { - final var fixture = extractResources("mng-8768"); + final var fixture = extractResources("gh-10115-profile-activation-by-executable"); // Resource extraction returns a shared directory. Never reuse its PATH entries or build output between cases. final var project = Files.createTempDirectory(fixture, getName() + "-"); Files.copy(fixture.resolve("pom.xml"), project.resolve("pom.xml")); @@ -131,7 +131,11 @@ private void verifyActivation(final Path project, final boolean active, final St final var support = Files.createDirectory(project.resolve("launcher-tools")); if (File.separatorChar == '\\') { // mvn.cmd uses findstr for compact option parsing. Do not expose all of System32 on PATH. - final var findstr = Path.of(System.getenv("SystemRoot"), "System32", "findstr.exe"); + // SystemRoot is optional in the environment, so never dereference it without a fallback. + final var systemRoot = System.getenv("SystemRoot"); + final var findstr = Path.of( + systemRoot == null || systemRoot.isBlank() ? "C:\\Windows" : systemRoot, "System32", "findstr.exe"); + assertTrue(Files.isRegularFile(findstr), "Missing Maven launcher prerequisite: " + findstr); Files.copy(findstr, support.resolve("findstr.exe")); } else { // The executor invokes bin/mvn, not java directly. Supply only its required external utilities. diff --git a/its/core-it-suite/src/test/resources/mng-8768/pom.xml b/its/core-it-suite/src/test/resources/gh-10115-profile-activation-by-executable/pom.xml similarity index 92% rename from its/core-it-suite/src/test/resources/mng-8768/pom.xml rename to its/core-it-suite/src/test/resources/gh-10115-profile-activation-by-executable/pom.xml index 47e211f50f..c96b056306 100644 --- a/its/core-it-suite/src/test/resources/mng-8768/pom.xml +++ b/its/core-it-suite/src/test/resources/gh-10115-profile-activation-by-executable/pom.xml @@ -20,12 +20,12 @@ under the License. <project xmlns="http://maven.apache.org/POM/4.1.0"> <modelVersion>4.1.0</modelVersion> - <groupId>org.apache.maven.its.mng8768</groupId> + <groupId>org.apache.maven.its.gh10115</groupId> <artifactId>profile-activation-by-executable</artifactId> <version>0.1</version> <packaging>pom</packaging> - <name>Maven Integration Test :: MNG-8768</name> + <name>Maven Integration Test :: GH-10115</name> <description>Executable profile activation detects files on PATH without executing them.</description> <properties> @@ -60,7 +60,7 @@ under the License. <profile> <id>executable</id> <activation> - <condition>executable('mng8768-profile-tool')</condition> + <condition>executable('gh10115-profile-tool')</condition> </activation> <properties> <executable.profile>active</executable.profile>
