Search code examples
sbtliftscala-2.11

Bad symbolic reference to scala.ScalaObject


I'm attempting to initiate a basic sbt build for the Lift framework and running into the following error:

[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

This is my build file, run under 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"
  )
}

There are similar questions here and here, but I don't understand the answers, and they are not helping me solve the problem. I recently both upgraded to Scala 2.11.1 and upgraded the dependencies declared within sbt, but I'm not sure where the problem is actually arising. My specific question is: how do I trace from the error above to the dependency that is causing this problem? Or, if it is not an issue of a dependency, where the issue lies and how do I determine where that is?


Solution

  • A quick glance looks like you might be using a scala 2.9.1 version of Lift-JQuery. From their docs:

    For versions >= 2.3

    "net.liftmodules" %% "moduleName_x1.y1 % "x2.y2[.z2][-SNAPSHOT/rcx/mx]"

    Where x1.y1 is Lift major and minor version numbers and a.b.c is Scala version number and x2.y2.[z2] is the module's major x2, minor y2 and eventual incremental numbers z2 followed by a eventual SNAPSHOT release candidate (rcX) or milestone (mX) version part.

    Trying: "net.liftmodules" % "lift-jquery-module_2.6" % "2.8" might fix your issue