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

sjaranowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-clean-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new f52fc9e  [MCLEAN-110, MCLEAN-124, MCLEAN-126, ] Merge 3.x to 4.x (#86)
f52fc9e is described below

commit f52fc9e57b4727bfcf3a9ca52ce83379e1c15c25
Author: Peter De Maeyer <peter.de.mae...@gmail.com>
AuthorDate: Wed Feb 19 10:04:05 2025 +0100

    [MCLEAN-110, MCLEAN-124, MCLEAN-126, ] Merge 3.x to 4.x (#86)
---
 src/it/dangling-symlinks/setup.groovy                  | 18 +++++++-----------
 src/it/symlink-dont-follow/setup.groovy                | 18 ++++++------------
 .../java/org/apache/maven/plugins/clean/CleanMojo.java |  6 +++---
 3 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/src/it/dangling-symlinks/setup.groovy 
b/src/it/dangling-symlinks/setup.groovy
index 81623d1..be18cfd 100644
--- a/src/it/dangling-symlinks/setup.groovy
+++ b/src/it/dangling-symlinks/setup.groovy
@@ -17,28 +17,24 @@
  * under the License.
  */
 
-import java.io.*;
 import java.nio.file.*;
-import java.util.*;
-import java.util.jar.*;
-import java.util.regex.*;
-import org.apache.maven.plugins.clean.*;
+import java.nio.file.attribute.*;
 
 try
 {
-    File targetDir = new File( basedir, "target" );
-    File link = new File( targetDir, "link" );
-    File target = new File( targetDir, "link-target.txt" );
+    Path targetDir = basedir.toPath().resolve( "target" );
+    Path link = targetDir.resolve( "link" );
+    Path target = targetDir.resolve( "link-target.txt" );
 
     System.out.println( "Creating symlink " + link + " -> " + target );
-    Files.createSymbolicLink( link.toPath(), target.toPath() );
-    if ( !link.exists() )
+    Files.createSymbolicLink( link, target, new FileAttribute[0] );
+    if ( !Files.exists( link, new LinkOption[0] ) )
     {
         System.out.println( "Platform does not support symlinks, skipping 
test." );
     }
 
     System.out.println( "Deleting symlink target " + target );
-    target.delete();
+    Files.delete( target );
 }
 catch( Exception ex )
 {
diff --git a/src/it/symlink-dont-follow/setup.groovy 
b/src/it/symlink-dont-follow/setup.groovy
index 7ae9bc5..37fac7e 100644
--- a/src/it/symlink-dont-follow/setup.groovy
+++ b/src/it/symlink-dont-follow/setup.groovy
@@ -17,12 +17,8 @@
  * under the License.
  */
 
-import java.io.*;
 import java.nio.file.*;
-import java.util.*;
-import java.util.jar.*;
-import java.util.regex.*;
-import org.apache.maven.plugins.clean.*;
+import java.nio.file.attribute.*;
 
 def pairs =
 [
@@ -34,13 +30,11 @@ def pairs =
 
 for ( pair : pairs )
 {
-    File target = new File( basedir, pair[0] );
-    File link = new File( basedir, pair[1] );
-    println "Creating symlink " + link + " -> " + target;
-    Path targetPath = target.toPath();
-    Path linkPath = link.toPath();
-    Files.createSymbolicLink( linkPath, targetPath );
-    if ( !link.exists() )
+    Path target = basedir.toPath().resolve( pair[0] );
+    Path link = basedir.toPath().resolve( pair[1] );
+    System.out.println( "Creating symlink " + link + " -> " + target );
+    Files.createSymbolicLink( link, target, new FileAttribute[0] );
+    if ( !Files.exists( link, new LinkOption[0] ) )
     {
         println "Platform does not support symlinks, skipping test.";
         return;
diff --git a/src/main/java/org/apache/maven/plugins/clean/CleanMojo.java 
b/src/main/java/org/apache/maven/plugins/clean/CleanMojo.java
index 44ceb48..e3a2004 100644
--- a/src/main/java/org/apache/maven/plugins/clean/CleanMojo.java
+++ b/src/main/java/org/apache/maven/plugins/clean/CleanMojo.java
@@ -188,7 +188,7 @@ public class CleanMojo implements 
org.apache.maven.api.plugin.Mojo {
      * <code>${maven.multiModuleProjectDirectory}/target/.clean</code> 
directory will be used.  If the
      * <code>${build.directory}</code> has been modified, you'll have to 
adjust this property explicitly.
      * In order for fast clean to work correctly, this directory and the 
various directories that will be deleted
-     * should usually reside on the same volume. The exact conditions are 
system dependant though, but if an atomic
+     * should usually reside on the same volume.  The exact conditions are 
system-dependent though, but if an atomic
      * move is not supported, the standard deletion mechanism will be used.
      *
      * @since 3.2
@@ -201,8 +201,8 @@ public class CleanMojo implements 
org.apache.maven.api.plugin.Mojo {
      * Mode to use when using fast clean.  Values are: <code>background</code> 
to start deletion immediately and
      * waiting for all files to be deleted when the session ends, 
<code>at-end</code> to indicate that the actual
      * deletion should be performed synchronously when the session ends, or 
<code>defer</code> to specify that
-     * the actual file deletion should be started in the background when the 
session ends (this should only be used
-     * when maven is embedded in a long running process).
+     * the actual file deletion should be started in the background when the 
session ends.  This should only be used
+     * when maven is embedded in a long-running process.
      *
      * @since 3.2
      * @see #fast

Reply via email to