Dav*_*vid 5 scala intellij-idea sbt
我希望测试编译操作将 src/test/resources 的内容放入 target/scala_2.8.1/test-classes 中。
原因是我使用 IntelliJ IDEA 运行 SBT,它在运行测试时将 test-classes 目录放在类路径上。
我的 logback-test.xml 文件(logback 日志框架的配置)位于 src/test/resources 中,但在测试过程中未找到它。
这并没有直接回答您的问题,而是显示了我使用的替代方案。
我添加了两个新任务:prepare和test-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")
Run Code Online (Sandbox Code Playgroud)
然后,我将“运行前”SBT 操作配置为这些。这需要idea-sbt-plugin。

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

| 归档时间: |
|
| 查看次数: |
1802 次 |
| 最近记录: |