加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

scala – 如何更改SBT放置测试资源的目录?

发布时间:2020-12-16 18:14:05 所属栏目:安全 来源:网络整理
导读:我希望test-compile操作将src / test / resources的内容放入target / scala_2.8.1 / test-classes中. 原因是我正在使用IntelliJ IDEA运行SBT,它在运行测试时将test-classes目录放在类路径上. 我的logback-test.xml文件(logback日志框架的配置)存在于src / te
我希望test-compile操作将src / test / resources的内容放入target / scala_2.8.1 / test-classes中.

原因是我正在使用IntelliJ IDEA运行SBT,它在运行测试时将test-classes目录放在类路径上.

我的logback-test.xml文件(logback日志框架的配置)存在于src / test / resources中,并且在测试期间找不到它.

解决方法

这不会直接回答您的问题,而是显示我使用的替代方案.

我添加了两个新任务:准备和测试准备.

lazy val prepare = task{
  None
} dependsOn (compile,copyResources) describedAs ("Compiles main,copies main resources. Use for the before-action in the idea-sbt-plugin")

lazy val testPrepare = task{
  None
} dependsOn (testCompile,copyResources,copyTestResources) describedAs ("Compiles main and test,copies all resources. Use for the before-action in the idea-sbt-plugin")

然后我将’运行前’SBT操作配置为这些.这需要idea-sbt-plugin.

我使用sbt-idea SBT处理器配置IntelliJ模块设置.这包括target / scala_2.8.1 / [test-]资源作为依赖项.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读