This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch gnodet/gh-12288-fileutils-cleanup in repository https://gitbox.apache.org/repos/asf/maven.git
commit 18e348b3e4def5a7ec2ed5c298f504e64c04cd7e Author: Guillaume Nodet <[email protected]> AuthorDate: Thu Jun 18 14:11:11 2026 +0200 [#12288] Use FileUtils.deleteDirectory() instead of custom helper Replace hand-rolled deleteRecursivelyIfExists with the existing FileUtils.deleteDirectory() already used by other ITs in the suite. Co-Authored-By: Claude Opus 4.6 <[email protected]> --- ...MavenITgh12288SettingsProfileAetherPropertiesTest.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh12288SettingsProfileAetherPropertiesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh12288SettingsProfileAetherPropertiesTest.java index be3508b767..625c50d640 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh12288SettingsProfileAetherPropertiesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh12288SettingsProfileAetherPropertiesTest.java @@ -19,9 +19,8 @@ package org.apache.maven.it; import java.io.File; -import java.nio.file.Files; -import java.util.Comparator; +import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -80,7 +79,7 @@ public void testActiveByDefaultDeactivatedViaCli() throws Exception { // Sibling tests in this class install under the same custom prefix; clear it to // avoid false positives if those tests ran first. File customPrefixSubtree = new File(verifier.getLocalRepository(), "it-custom-prefix"); - deleteRecursivelyIfExists(customPrefixSubtree); + FileUtils.deleteDirectory(customPrefixSubtree); verifier.addCliArgument("--settings"); verifier.addCliArgument("settings-active-by-default.xml"); @@ -103,16 +102,6 @@ public void testActiveByDefaultDeactivatedViaCli() throws Exception { "Found artifact at custom prefix " + customPrefix + " — deactivation via -P ! was ignored."); } - private static void deleteRecursivelyIfExists(File path) throws Exception { - if (!path.exists()) { - return; - } - Files.walk(path.toPath()) - .sorted(Comparator.reverseOrder()) - .map(java.nio.file.Path::toFile) - .forEach(File::delete); - } - private void runAndAssertCustomPrefix(String settingsFile) throws Exception { File testDir = extractResources("/settings-profile-aether-properties");
