mvn clean 擦除的目录可以自定义吗?

Can the directories wiped by mvn clean be customized?

宁运行后

mvn clean

我在尝试 运行 我的项目中的二进制文件时遇到了一些糟糕的时刻。首先,选定的二进制文件没有 运行 - 然后发现 整个 /bin 目录已被删除 。有点恐慌之后,发现 - 在 durable/checked 个文件中 - 只有 bin 目录被破坏了。

这是 mvn clean 结果的片段:虽然 libs 目录需要删除.. bin 不是 .

--- maven-clean-plugin:2.5:clean (default-clean) @ parent ---
[INFO] Deleting /git/OCspark/bin (includes = [], excludes = [])
[INFO] Deleting /git/OCspark/libs (includes = [**/*.jar], excludes = [])

是否有配置通知 clean 什么是 "OK" 擦除什么是 "off limits"?

您可以将 maven-clean-plugin 配置为 include and exclude 附加文件。检查任何现有的包含项和排除项。

或者,您可以尝试在配置中使用两个 fileset 来分别包含和排除,有点像(未测试):

<configuration>
  <filesets>
    <fileset>
      <directory>/git/OCspark/libs</directory>
      <includes>
        <include>**/*.*</include>
      </includes>
      <followSymlinks>false</followSymlinks>
    </fileset>
    <fileset>
      <directory>/git/OCspark/bin</directory>
      <excludes>
        <exclude>**/*.*</exclude>
      </excludes>
      <followSymlinks>false</followSymlinks>
    </fileset>
  </filesets>
</configuration>