java.lang.NoClassDefFoundError: scala/Product$class

前端 未结 1 1748
半阙折子戏
半阙折子戏 2020-12-09 08:14

I am new to scala and I am trying out few sample codes for testing. However I am facing some issues when I run the test code. When I run the test, I am getting an error

相关标签:
1条回答
  • 2020-12-09 09:05

    your sbt build file is not right. your scala version is 2.12.x but you are using libraries compiled in scala version 2.11. use the sbt settings shown below

    note: I changed the version of scalatest as 2.x versions are no longer supported for 2.12 version of scala

    scalaVersion := "2.12.1"
    
    libraryDependencies ++= Seq(
      "org.scala-js" %% "scalajs-test-interface" % "0.6.14",
      "org.scalatest" %% "scalatest" % "3.0.1", //version changed as these the only versions supported by 2.12
      "com.novocode" % "junit-interface" % "0.11",
      "org.scala-lang" % "scala-library" % scalaVersion.value
    )
    

    remember to do reload, clean and compile in your sbt console to start clean compile

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