0
votes

I am trying to create a REST service using Spray Servlet, but does not compile. Below you can find my build.sbt:

name := "someservice"

version := "0.0.1"

scalaVersion := "2.10.0"

resolvers += "spray repo" at "http://repo.spray.io"

libraryDependencies += "io.spray" % "spray-servlet" % "1.0-M3"

libraryDependencies ++= Seq(
  "io.spray"            %   "spray-servlet" % "1.0-M3",
  "io.spray"            %   "spray-util"    % "1.0-M3",
  "io.spray"            %   "spray-http"    % "1.1-M7",
  "com.typesafe.akka"   %%  "akka-actor"    % "2.1.0",
  "org.specs2"          %%  "specs2"        % "1.13" % "test",
  "org.eclipse.jetty.orbit" %   "javax.servlet"  % "3.0.0.v201112011016" artifacts Artifact("javax.servlet", "jar", "jar")
 )

There error I get com 'sbt update compile' is:

[error] bad symbolic reference. A signature in package.class refers to term Either [error] in package scala which is not available. [error] It may be completely missing from the current classpath, or the version on [error] the classpath might be incompatible with the version used when compiling [error] package.class. [error] bad symbolic reference. A signature in package.class refers to type Future [error] in package akka.dispatch which is not available. [error] It may be completely missing from the current classpath, or the version on [error] the classpath might be incompatible with the version used when [error] compiling package.class. [error] two errors found [error] (compile:compile) Compilation failed

Do I have to add the scala library to the sbt build file as well or am I missing something else?

2
Use the same version of spray for the different modules, and you don't need the akka dependency as Spray should pull that in automatically. Does that help?Viktor Klang
Could you share the full source of your project? This might be a bug.Iulian Dragos
You only need to declare spray-servlet, and spray-routing from spray. You also have to include akka-actor (as you are doing) because it is only declared "provided" in spray. If you still have problems, you can also ask at the spray-user mailing list.jrudolph

2 Answers

2
votes

tld;dr: try replacing 1.0-M3 with 1.1-M7

It looks like the Spray artifacts you're using were compiled against Scala 2.9.2, which is not binary compatible with Scala 2.10. Usually, Scala artifacts contain the Scala binary version in the artifact name, precisely because major Scala versions are not binary compatible.

Later spray-util milestones were compiled against Scala 2.10.0-RC5 (based on the pom), which technically should work.

0
votes

Solved by using all the same spray versions (1.1-M7) and upgrading to Scala 2.10.1