maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: Maven clean plugin not deleting file
Date Sat, 13 Sep 2014 12:36:44 GMT
I need to takeoff soon so unfortunately I cannot put any time into investigating until maybe
tonite
but Here is the CleanMojo code:

execute()
{
</snip>
     try
        {
            File[] directories = getDirectories();
            for ( int i = 0; i < directories.length; i++ )
            {
                File directory = directories[i];
                if ( directory != null )
                {
                    cleaner.delete( directory, null, followSymLinks, failOnError, retryOnError
);
//can we assume the directory remains intact?
                }
            }

            if ( filesets != null )
            {
                for ( int i = 0; i < filesets.length; i++ )
                {
                    Fileset fileset = filesets[i];
                    if ( fileset.getDirectory() == null )
                    {
                        throw new MojoExecutionException( "Missing base directory for " +
fileset );
                    }
                    GlobSelector selector =
                        new GlobSelector( fileset.getIncludes(), fileset.getExcludes(), fileset.isUseDefaultExcludes()
);
                    cleaner.delete( fileset.getDirectory(), selector, fileset.isFollowSymlinks(),
failOnError,
                                    retryOnError );
                }
            }
        }
        catch ( IOException e )
        {
            throw new MojoExecutionException( "Failed to clean project: " + e.getMessage(),
e );
        }

Fileset.java
public class Fileset
{

    private File directory;
    public File getDirectory()
    {
        return directory;
    }

at first blush maybe you didnt specify directory?

are there any other messages?

Martin 



> Date: Sat, 13 Sep 2014 17:22:04 +0530
> Subject: Maven clean plugin not deleting file
> From: saurav.sarkar1@gmail.com
> To: users@maven.apache.org
> 
> Hi All,
> 
> I have two files in my directory like this:
> 
>    - a.b.so
>    - a.so
> 
> I want to delete only a.b.so.
> 
> So here is my Maven clean plugin entry in my pom.xml file:
> 
> <plugin>
> <artifactId>maven-clean-plugin</artifactId>
> <executions>
>   <execution>
>     <id>auto-clean</id>
>     <phase>prepare-package</phase>
>     <goals>
>       <goal>clean</goal>
>     </goals>
>     <configuration>
>     <excludeDefaultDirectories>true</excludeDefaultDirectories>
>      <filesets>
>         <fileset>
>       <directory>${project.build.directory}/libs/x86</directory>
>       <includes>
>         <include>*.so</include>
>       </includes>
>       <excludes>
>        <exclude>a.so</exclude>
>       <excludes>
>        <followSymlinks>false</followSymlinks>
>     </fileset>
>       </filesets>
>       <verbose>true</verbose>
>     </configuration>
>   </execution>
> </executions>
> 
> Just for some backgorund of this, file a.b.so gets downloaded as a
> dependency then it gets renamed into a.so just before i execute the above
> entry. I copy file using maven depedency plugin. I don't know whether this
> affects the not deletion of a.b.so later on or not.
> 
> In turn it always delete a.so. Even I tried including **/*, but it deletes
> a.so every time.
> 
> It never deletes a.b.so.
> 
> cheers,
> 
> Saurav
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message