I am trying to run a test using sbt
and I am being thrown the java.lang.NoClassDefFoundError: scala/collection/GenTraversableOnce$class
.
My environment is: Unix
, sbt
, scalatest
.
I have pointed the scalalibrary
to the one which I installed instead of the IntelliJ plugin(which dint work either)
Project Build File
name := "PleaseGod"
version := "1.0"
scalaVersion := "2.11.5"
libraryDependencies += "org.scalatest" % "scalatest_2.11" % "2.2.1" % "test"
libraryDependencies += "org.seleniumhq.selenium" % "selenium-java" % "2.35.0" % "test"
libraryDependencies += "org.scala-lang.modules" % "scala-xml_2.11" % "1.0.1"
Please refer the following link for the project structure : http://imgur.com/iugBPD6
I hit this exact same problem after generating a scala project from a giter8 template ( fayimora/basic-scala-project
listed here)
The problem was that the Scala version was 2.11.5
but the ScalaTest version was 2.10
. Contents for build.sbt
:
scalaVersion := "2.11.5"
libraryDependencies ++= Seq(
"org.scalatest" % "scalatest_2.10" % "2.2.1" % "test" withSources() withJavadoc(),
"org.scalacheck" %% "scalacheck" % "1.12.1" % "test" withSources() withJavadoc()
After I changed it to "scalatest_2.11
it compiled and executed tests as expected.
I see that your configuration is using scalatest_2.11
so I suspect one of your other dependencies has a similar Scala version conflict?
I also added a project/build.properties
file that explicitly set the sbt version to 0.13.8
sbt.version=0.13.8
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.