You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2026/06/18 12:11:39 UTC

(maven) branch gnodet/gh-12288-fileutils-cleanup created (now 18e348b3e4)

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

gnodet pushed a change to branch gnodet/gh-12288-fileutils-cleanup
in repository https://gitbox.apache.org/repos/asf/maven.git


      at 18e348b3e4 [#12288] Use FileUtils.deleteDirectory() instead of custom helper

This branch includes the following new commits:

     new 18e348b3e4 [#12288] Use FileUtils.deleteDirectory() instead of custom helper

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(maven) 01/01: [#12288] Use FileUtils.deleteDirectory() instead of custom helper

Posted by gn...@apache.org.
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 <gn...@gmail.com>
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 <no...@anthropic.com>
---
 ...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");