Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

followSymlinks doesn't work for maven-clean-plugin

I am trying to use "maven-clean-plugin" to delete additional files situated in /my/path folder.

<plugin>
   <artifactId>maven-clean-plugin</artifactId>
   <executions>
       <execution>
           <id>clean-on-cleaning</id>
           <phase>clean</phase>
           <goals>
               <goal>clean</goal>
           </goals>
           <configuration>                      
               <filesets>
                   <fileset>
                       <directory>target/dart</directory>
                   </fileset>
                   <fileset>
                       <directory>src/main/dart/.pub</directory>
                   </fileset>
                   <fileset>
                       <directory>src/main/dart/build</directory>
                   </fileset>
                   <fileset>
                       <directory>${env.APPDATA}/Pub/Cache</directory>
                   </fileset>
                   <fileset>
                       <directory>src/main/dart/packages</directory>    
                       <followSymlinks>false</followSymlinks>
                   </fileset>
               </filesets>
           </configuration>
       </execution>
   </executions>

"src/main/dart/packages" contains links. And one of the links points to "src/main/dart/lib" folder. I have set:

<followSymlinks>false</followSymlinks> 

So it shouldn't delete files in lib directory. But unfortunately it does. Where the problem could be?

Environment configuration:

  • Maven: apache-maven-3.3.3
  • Java version: 1.7.0_55(also tried on 1.8.0_51)
  • OS name: windows 7
  • version: 6.1
  • arch: amd64
like image 676
Dezmond Avatar asked Nov 08 '22 19:11

Dezmond


1 Answers

Judging by your configuration, you are using the version of the maven-clean-plugin that is coming from the default binding of the clean lifecycle. This is version 2.5 for Maven 3.3.3.

For this version, there is a bug that the maven-clean-plugin does not respect the followSymLinks attribute on Windows: it is MCLEAN-58:

Maven Clean Plugin ignores followSymLinks parameter on Windows

This has been fixed in version 2.6.1 according to this bug report, for users having Java >= 7, which is your case.

Therefore, you just need to update the version of the maven-clean-plugin you are using to 2.6.1. The current version is 3.0.0 so you might as well update to that one:

<plugin>
   <artifactId>maven-clean-plugin</artifactId>
   <version>3.0.0</version>
   <!-- rest of configuration -->
</plugin>
like image 185
Tunaki Avatar answered Nov 15 '22 07:11

Tunaki