Maven clean not deleting files

早过忘川 提交于 2019-12-11 14:57:35

问题


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

In turn it always delete a.so. Even I tried including **/*, but it deletes a.so every time.

It never deletes a.b.so.


回答1:


For this particular example, you can try to replace this part:

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

with

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


来源:https://stackoverflow.com/questions/25822100/maven-clean-not-deleting-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!