【问题标题】:Maven clean not deleting filesMaven clean 不删除文件
【发布时间】:2014-11-07 10:45:18
【问题描述】:

我的目录中有两个文件,如下所示:

  • a.b.so
  • a.so

我只想删除a.b.so

所以这是我的 pom.xml 文件中的 Maven 清理插件条目:

<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>

只是为了一些背景,文件 a.b.so 被下载为依赖项,然后在我执行上述条目之前它被重命名为 a.so。我使用 Maven 依赖插件复制文件。不知道这会不会影响不删除a.b.so

反过来它总是删除a.so。即使我尝试包含**/*,但它每次都会删除a.so

它永远不会删除a.b.so

【问题讨论】:

    标签: maven maven-clean-plugin


    【解决方案1】:

    对于这个特定的例子,你可以尝试替换这部分:

      <includes>
        <include>*.so</include>
      </includes>
      <excludes>
       <exclude>a.so</exclude>
      <excludes>
    

      <includes>
        <include>a.b.so</include>
      </includes>
    

    【讨论】:

      猜你喜欢
      • 2018-05-18
      • 2021-08-30
      • 2012-11-29
      • 2011-01-15
      • 2016-04-19
      • 2016-03-29
      • 2018-05-28
      • 2017-04-22
      • 1970-01-01
      相关资源
      最近更新 更多