gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 20:50:59 24 4
gpt4 key购买 nike

我希望测试编译操作将 src/test/resources 的内容放入 target/scala_2.8.1/test-classes。

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

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

最佳答案

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

我添加了两个新任务:preparetest-prepare .

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 .

alt text

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

alt text

关于scala - 如何更改 SBT 放置测试资源的目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4755234/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com