我有一个基于Play框架的webapp,它在其build.sbt文件中定义了以下内容:
....
version := "1.0-SNAPSHOT"
resolvers += "Sonatype Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"
resolvers += "Sonatype Releases" at "https://oss.sonatype.org/content/groups/scala-tools"
resolvers += "Novus Releases" at "http://repo.novus.com/releases/"
libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
"com.mongodb.casbah" % "casbah_2.9.0" % "2.2.0-SNAPSHOT",
"com.novus" %% "salat-core" % "1.9.2",
"org.scalatest" % "scalatest_2.10" % "2.0" % "test",
"com.typesafe" % "config" % "1.0.2"
)
....Scala版本为2.10.3,当我尝试运行单元测试时,会遇到以下错误:
A needed class was not found. This could be due to an error in your runpath. Missing class: scala/reflect/ClassManifest
java.lang.NoClassDefFoundError: scala/reflect/ClassManifest
at com.mongodb.casbah.Imports$.<init>(Implicits.scala:113)
at com.mongodb.casbah.Imports$.<clinit>(Implicits.scala)
at com.mongodb.casbah.MongoConnection.apply(MongoConnection.scala:177)
........
........我完全不知道为什么会发生这种事?我漏掉了哪个图书馆?
发布于 2013-12-19 19:28:09
您不能混合主要的 scala版本(参见,casbah工件是针对Scala2.9.*编译的,而scala_test是2.10.*,您是说您在intellij中使用了2.10 )。
错误说,编译器找不到自2.9.*以来从scala库中删除的类,解决方案是选择适当的scala版本(任何2.10.*都可以)。
发布于 2013-12-19 19:46:36
这里的作者。解决办法是修理你的助手。Salat的最新稳定版本是1.9.4,这取决于Casbah 2.6.4 --这两种版本都有2.9和2.10版本。
发布于 2013-12-20 14:06:30
我没有直接使用卡巴驱动程序来玩游戏,而是重新使用了一个名为play-salat (https://github.com/leon/play-salat)的插件。
我目前使用的是"se.radley“% " Play -plugins-salat_2.10”% "1.3.0“,并且在Play 2.2中运行良好。
https://stackoverflow.com/questions/20689773
复制相似问题