How do I run JUnit 4.11 test cases with SBT?

后端 未结 2 1636
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-30 10:25

I have the following in build.sbt:

libraryDependencies += \"com.novocode\" % \"junit-interface\" % \"0.10\" % \"test\"

libraryDependencies          


        
相关标签:
2条回答
  • 2020-12-30 10:50

    Use junit-interface 0.11 to avoid the dependency on junit-dep:

    libraryDependencies += "junit" % "junit" % "4.12" % "test"
    
    libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
    

    UPDATE: junit-interface 0.11 makes this reliable by depending on junit rather than junit-dep.

    0 讨论(0)
  • 2020-12-30 11:11

    I would do this:

    libraryDependencies ++= Seq(
      "junit" % "junit" % "4.11" % Test,
      "com.novocode" % "junit-interface" % "0.11" % Test
            exclude("junit", "junit-dep")
    )
    

    By excluding what we don't desire, it doesn't interfere. This doesn't depend on ordering.

    0 讨论(0)
提交回复
热议问题