2

Following is the core of the project/build.sbt for a scalatra/spark project :

  val ScalaVersion = "2.11.6"
  val ScalatraVersion = "2.4.0-RC2-2"

//   ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true)}
  lazy val project = Project (
    "keywordsservlet",
    file("."),
    settings = ScalatraPlugin.scalatraSettings ++ scalateSettings ++ Seq(
      organization := Organization,
      name := Name,
      version := Version,
      scalaVersion := ScalaVersion,
      resolvers += Classpaths.typesafeReleases,
      resolvers += "Scalaz Bintray Repo" at "http://dl.bintray.com/scalaz/releases",
      libraryDependencies ++= Seq(
//        "org.scala-lang" % "scala-reflect" % ScalaVersion,
        "org.apache.spark" % "spark-core_2.11" % "1.4.1",
        "org.scalatra" %% "scalatra" % ScalatraVersion,
        "org.scalatra" %% "scalatra-scalate" % ScalatraVersion,
        "org.scalatra" %% "scalatra-specs2" % ScalatraVersion % "test",
        "ch.qos.logback" % "logback-classic" % "1.1.2" % "runtime",
        "org.eclipse.jetty" % "jetty-webapp" % "9.2.10.v20150310" % "container",
        "javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided"
      ),

Here is the sbt output: notice it is loading a 2.10 target !

$ sbt   

[info] Loading project definition from /shared/keywords/project
[info] Updating {file:/shared/keywords/project/}keywords-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 1 Scala source to /shared/keywords/project/target/scala-2.10/sbt-0.13/classes...
[info] Set current project to KeywordsServlet (in build file:/shared/keywords/)

So what is happening here?

WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560

1 Answers1

4

There is a difference between the version of Scala that you are using for your project and the version of Scala that sbt itself uses.

sbt 0.13 can compile 2.9, 2.10 and 2.11 (and 2.12). However, when it compiles your build.sbt or Build.scala files, sbt 0.13 uses Scala 2.10.

Similarly, all of the plugins that sbt uses are compiled with 2.10.

On the other hand, sbt 0.12 used Scala 2.9.

Matthew Farwell
  • 60,889
  • 18
  • 128
  • 171
  • Ah! I was worried because there is a scala-reflect.jar versioning mismatch occurrding in my scalatra/spark project. Trying to track down carefully the potential sources of conflict: now that's one less! – WestCoastProjects Aug 25 '15 at 17:31