我在build.sbt中有以下内容:
libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test"
libraryDependencies += "junit" % "junit" % "4.11" % "test"
我注意到 junit-interface 0.10 依赖于 junit-dep 4.10。这使得无法编译使用 assertNotEquals 的测试,该测试是在 junit 4.11 中引入的。
如何使用 SBT 运行 JUnit 4.11 测试用例?
最佳答案
我会这样做:
libraryDependencies ++= Seq(
"junit" % "junit" % "4.11" % Test,
"com.novocode" % "junit-interface" % "0.11" % Test
exclude("junit", "junit-dep")
)
通过排除我们不想要的东西,它不会造成干扰。这不依赖于排序。
关于junit - 如何使用 SBT 运行 JUnit 4.11 测试用例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22200130/