【问题标题】:How to exclude unmanaged resources from Compile scope only (not from Test)如何仅从编译范围(而不是从测试)中排除非托管资源
【发布时间】:2013-10-07 23:15:09
【问题描述】:

在我的一个子项目中,我试图从我的非托管资源列表中排除 *.conf 和 *.groovy 文件:

excludeFilter in Compile in unmanagedResources  := "*.conf" || "*.groovy"

现在,这可行,但会产生意想不到的效果,即从测试中删除 *.conf 文件。 我尝试添加以下 includeFilter 设置:

includeFilter in Test in unmanagedResources := "*.conf"

但是,这不起作用。 我认为测试和编译之间存在可能导致此问题的关系。 任何的意见都将会有帮助。 谢谢。

【问题讨论】:

    标签: scala testing settings sbt unmanagedresources


    【解决方案1】:

    这里有两个问题,您已经确定了主要的一个,即测试和编译之间的关系。另一个是一个文件必须同时被includeFilter包含并且不能被excludeFilter排除。

    如果没有为 Test 明确指定任何设置,则 Test 从 Compile 获取其设置。当您定义excludeFilter in Compile 时,它也适用于Test。因此,您可以将excludeFilter in Test 定义为默认值,即忽略隐藏文件:

    excludeFilter in Test := HiddenFileFilter
    

    (或者,您可以使用NoFilter 来排除任何排除。)

    【讨论】:

      猜你喜欢
      • 2013-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-05
      相关资源
      最近更新 更多