Author: bentmann Date: Sat Sep 6 13:21:37 2008 New Revision: 692725 URL: http://svn.apache.org/viewvc?rev=692725&view=rev Log: [MCLEAN-28] maven-clean-plugin doesn't delete directories with symlinks in them
o Added integration test to prove incorporation of fix from PLXUTILS-28 in r692711 Added: maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/ maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/pom.xml (with props) maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/setup.bsh (with props) maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/target/ maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/target/link-target.txt (with props) maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/verify.bsh (with props) Added: maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/pom.xml?rev=692725&view=auto ============================================================================== --- maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/pom.xml (added) +++ maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/pom.xml Sat Sep 6 13:21:37 2008 @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>test</groupId> + <artifactId>dangling-symlinks</artifactId> + <version>1.0-SNAPSHOT</version> + + <description>Check for proper cleaning of dangling symlinks.</description> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <version>@pom.version@</version> + </plugin> + </plugins> + </build> + +</project> Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/pom.xml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/setup.bsh URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/setup.bsh?rev=692725&view=auto ============================================================================== --- maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/setup.bsh (added) +++ maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/setup.bsh Sat Sep 6 13:21:37 2008 @@ -0,0 +1,43 @@ +import java.io.*; +import java.util.*; +import java.util.jar.*; +import java.util.regex.*; + +boolean createSymlink( File link, File target ) +{ + try + { + String[] args = { "ln", "-s", target.getAbsolutePath(), link.getAbsolutePath() }; + Process process = Runtime.getRuntime().exec( args ); + process.waitFor(); + return 0 == process.exitValue(); + } + catch ( Exception e ) + { + // assume platform does not support "ln" command, test should be skipped + return false; + } +} + +try +{ + File targetDir = new File( basedir, "target" ); + File link = new File( targetDir, "link" ); + File target = new File( targetDir, "link-target.txt" ); + + System.out.println( "Creating symlink " + link + " -> " + target ); + if ( !createSymlink( link, target ) ) + { + System.out.println( "FAILURE, platform does not support symlinks, skipping test." ); + } + + System.out.println( "Deleting symlink target " + target ); + target.delete(); +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/setup.bsh ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/setup.bsh ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/target/link-target.txt URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/target/link-target.txt?rev=692725&view=auto ============================================================================== (empty) Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/target/link-target.txt ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/target/link-target.txt ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/verify.bsh URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/verify.bsh?rev=692725&view=auto ============================================================================== --- maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/verify.bsh (added) +++ maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/verify.bsh Sat Sep 6 13:21:37 2008 @@ -0,0 +1,22 @@ +import java.io.*; +import java.util.*; +import java.util.jar.*; +import java.util.regex.*; + +try +{ + File targetDir = new File( basedir, "target" ); + System.out.println( "Checking for absence of " + targetDir ); + if ( targetDir.exists() ) + { + System.out.println( "FAILURE!" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/verify.bsh ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-clean-plugin/src/it/dangling-symlinks/verify.bsh ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision