我有一个多模块 sbt 项目,每个模块都有集成测试。模块
a
依赖于模块 b
进行编译、测试和集成测试范围。所以我在 Build.scala 中进行了这样的设置:
lazy val authorizationdeciderservice = Project(
id = "a",
base = file("modules/a"),
configurations = Seq(IntegrationTest),
dependencies = Seq(b % "compile;it->test;it")
)
现在
compile
和 it->test
依赖项工作正常,但 it
依赖项不能正常工作,因为我无法从 it
中的集成测试访问 b
中 a
路径上的资源。
可能是什么问题?
b % "compile;it->test;it"
与 b % "compile->compile;it->test;it->compile"
相同。要从 a 中的集成测试访问 b 中 it 路径上的资源,应该有 "it->it"
。
在 sbt 1.8.0 中使用
"it->it"
对我来说不起作用。我能够让它与 "test->it"
一起工作。这样做的缺点是使 "b"
的集成测试代码可以在 "a"
的常规测试中使用,但它至少避免了我本来会做的代码重复。最终,我将根据 sbt 1.9.0 的发行说明,转向推荐的单独子项目进行集成测试。