我正在尝试使用“maven-clean-plugin”删除位于/my/path 文件夹中的其他文件。
<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”包含链接。其中一个链接指向“src/main/dart/lib”文件夹。我已经设定:
<followSymlinks>false</followSymlinks>
所以它不应该删除 lib 目录中的文件。但不幸的是,它确实如此。问题可能出在哪里?
环境配置:
最佳答案
根据您的配置判断,您使用的是 maven-clean-plugin
的版本来自 clean
的默认绑定(bind)生命周期。 This is version 2.5 for Maven 3.3.3 .
对于这个版本,有一个错误 maven-clean-plugin
不尊重followSymLinks
Windows 上的属性:MCLEAN-58 :
Maven Clean Plugin ignores followSymLinks parameter on Windows
根据此错误报告,这已在版本 2.6.1 中修复,适用于 Java >= 7 的用户,这是您的情况。
因此,您只需更新
maven-clean-plugin
的版本即可。您正在使用 2.6.1。当前版本是 3.0.0,因此您不妨更新到该版本:<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<!-- rest of configuration -->
</plugin>
关于maven - followSymlinks 不适用于 maven-clean-plugin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35584992/