Skip to content

Commit

Permalink
[MCLEAN-110, MCLEAN-124, MCLEAN-126, ] Merge 3.x to 4.x (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdemaeyer authored Feb 19, 2025
1 parent 85f7a3d commit f52fc9e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
18 changes: 7 additions & 11 deletions src/it/dangling-symlinks/setup.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down
18 changes: 6 additions & 12 deletions src/it/symlink-dont-follow/setup.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
[
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/apache/maven/plugins/clean/CleanMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit f52fc9e

Please sign in to comment.