我试图为Lift框架启动一个基本的sbt构建并遇到以下错误:
[error] bad symbolic reference to scala.ScalaObject encountered in class file 'package.class'.
[error] Cannot access type ScalaObject in package scala. The current classpath may be
[error] missing a definition for scala.ScalaObject, or package.class may have been compiled against a version that's
[error] incompatible with the one found on the current classpath.
[error] one error found
[error] (compile:compile) Compilation failed
[error] Total time: 7 s, completed Aug 19, 2014 8:27:51 PM
这是我的构建文件,在sbt 0.13
下运行:
name := "MyApp"
version := "0.0.0"
organization := "com.myapp"
scalaVersion := "2.11.1"
EclipseKeys.createSrc := EclipseCreateSrc.Default + EclipseCreateSrc.Resource
resolvers ++= Seq("snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
"releases" at "http://oss.sonatype.org/content/repositories/releases",
"releases" at "http://oss.sonatype.org/content/repositories/releases"
)
seq(webSettings :_*)
unmanagedResourceDirectories in Test <+= (baseDirectory) { _ / "src/main/webapp" }
scalacOptions ++= Seq("-deprecation", "-unchecked")
libraryDependencies ++= {
val liftVersion = "2.6-RC1"
Seq(
"net.liftweb" %% "lift-webkit" % liftVersion % "compile",
"net.liftweb" %% "lift-mapper" % liftVersion % "compile",
"net.liftmodules" % "lift-jquery-module_2.6_2.9.1-1" % "2.8",
"org.eclipse.jetty" % "jetty-webapp" % "9.2.2.v20140723" % "container,test",
"org.eclipse.jetty" % "jetty-plus" % "9.2.2.v20140723" % "container,test", // For Jetty Config
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container,test" artifacts Artifact("javax.servlet", "jar", "jar"),
"org.specs2" %% "specs2" % "2.4.1" % "test",
"mysql" % "mysql-connector-java" % "5.1.+",
"org.slf4j" % "slf4j-log4j12" % "1.7.+",
"org.squeryl" % "squeryl_2.11" % "0.9.6-RC3"
)
}
有类似的问题here和here,但我不理解答案,他们并没有帮我解决问题。我最近都升级到Scala 2.11.1
并升级了sbt中声明的依赖项,但我不确定问题实际出现在哪里。我的具体问题是:如何从上面的错误跟踪导致此问题的依赖项?或者,如果它不是依赖问题,问题在哪里,我如何确定它在哪里?
答案 0 :(得分:3)
快速浏览一下,您可能正在使用Scala 2.9.1版本的Lift-JQuery。来自他们的文档:
对于版本&gt; = 2.3
“net.liftmodules”%%“moduleName_x1.y1% “x2.y2 [.z2] [ - 快照/ RCX / MX]”
其中x1.y1是Lift主要和次要版本号,a.b.c是Scala 版本号和x2.y2。[z2]是模块的主要x2,次要y2和 最终的增量数字z2,然后是最终的SNAPSHOT 发布候选者(rcX)或里程碑(mX)版本部分。
尝试:"net.liftmodules" % "lift-jquery-module_2.6" % "2.8"
可能会解决您的问题