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 Mon, 15 Sep 2014 22:26:33 GMT



> Date: Sat, 13 Sep 2014 18:30:10 +0530
> Subject: Re: Maven clean plugin not deleting file
> From: saurav.sarkar1@gmail.com
> To: users@maven.apache.org
> 
> Hi Martin,
> 
> Thanks for the reply.
> directory is properly mentioned because a.so is getting deleted.
> 
> Please note a.b.so has been downloaded a dependency and has been put to
> libs directory.
> 
> Best Regards,
> Saurav
> 
> On Sat, Sep 13, 2014 at 6:06 PM, Martin Gainty <mgainty@hotmail.com> wrote:
> 
> > 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>

MG>replace wildcard package/filename *.so with more specific filename include as seen here:
> > >         <!-- include>*.so</include -->
<include>a.b.so</include>
<include>b*.so</include>
<include>c*.so</include>
<include>d*.so</include>
<include>e*.so</include>
<include>f*.so</include>
<include>g*.so</include>
<include>h*.so</include>
<include>i*.so</include>
<include>j*.so</include>
<include>k*.so</include>
<include>l*.so</include>
<include>m*.so</include>
<include>n*.so</include>
<include>o*.so</include>
<include>p*.so</include>
<include>q*.so</include>
<include>r*.so</include>
<include>s*.so</include>
<include>t*.so</include>
<include>u*.so</include>
<include>v*.so</include>
<include>w*.so</include>
<include>x*.so</include>
<include>y*.so</include>
<include>z*.so</include>
MG>end

> > >       </includes>
> > >       <excludes>
> > >        <exclude>a.so</exclude>
> > >       <excludes>
> > >        <followSymlinks>false</followSymlinks>

MG>since we dont know what constitutes useDefaultExcludes .. we should exclude this unknown
entity
<useDefaultExcludes>true</useDefaultExcludes>
MG>end

> > >     </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.
MG>this should be left alone and not deleted
> > >
> > > It never deletes a.b.so.
> > >
> > > cheers,
> > >
> > > Saurav
> >
> >
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message