【问题标题】:Can the directories wiped by mvn clean be customized?可以自定义 mvn clean 擦除的目录吗?
【发布时间】:2018-04-14 12:43:56
【问题描述】:

运行后

mvn clean

尝试在我的项目中运行二进制文件时,我遇到了一个糟糕的时刻。首先选择的二进制文件没有运行 - 然后发现 整个 /bin 目录已被删除。在一阵恐慌之后,发现 - 在持久/签入文件中 - 只有 bin 目录已被删除。

这里是 mvn clean 的结果的 sn-p:而 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”可以擦除,什么是“禁止范围”?

【问题讨论】:

    标签: maven maven-clean-plugin


    【解决方案1】:

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

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

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

    【讨论】:

    • 天哪!我有一个明确的include 用于删除bin!可以看出这个项目已经有一段时间了
    猜你喜欢
    • 2021-06-20
    • 2017-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-16
    • 2016-04-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多