我的build.sbt的相关部分在这里:
libraryDependencies ++= Seq (
"org.scalatest" % "scalatest_2.10" % "1.9.1" % "test",
//Spray dependencies
"io.spray" % "spray-servlet" % "1.1-M7",
"com.typesafe.akka" %% "akka-actor" % "2.2-M3",
"com.typesafe.akka" %% "akka-slf4j" % "2.2-M3",
//Servlet API?
//"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" artifacts Artifact("javax.servlet", "jar", "jar"),
"javax.servlet" % "javax.servlet-api" % "3.0.1" % "provided",
"ch.qos.logback" % "logback-classic" % "1.0.12"
)
resolvers ++= Seq( "snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
"spray repo" at "http://repo.spray.io",
"typesafe repo" at "http://repo.typesafe.com/typesafe/releases/",
"releases" at "http://oss.sonatype.org/content/repositories/releases")
无论我尝试用于servlet API(或者根本不是Servlet API),我都会得到这12个错误:
[info] Loading global plugins from /home/dkowis/.sbt/plugins
[info] Loading project definition from /home/dkowis/gitwork/turbo-jug-robot/project
[info] Set current project to turbo-jug-robot (in build file:/home/dkowis/gitwork/turbo-jug-robot/)
[info] Updating {file:/home/dkowis/gitwork/turbo-jug-robot/}default-5e44c0...
[info] Resolving javax.servlet#javax.servlet-api;3.0.1 ...
[info] Done updating.
[info] Compiling 2 Scala sources to /home/dkowis/gitwork/turbo-jug-robot/target/scala-2.10/classes...
[error] /home/dkowis/gitwork/turbo-jug-robot/src/main/scala/spray/examples/DemoService.scala:15: not found: value Uri
[error] case HttpRequest(GET, Uri.Path("/"), _, _, _) =>
[error] ^
[error] /home/dkowis/gitwork/turbo-jug-robot/src/main/scala/spray/examples/DemoService.scala:48: overloaded method value apply with alternatives:
[error] (optionalBody: Option[spray.http.HttpBody])spray.http.HttpEntity <and>
[error] (buffer: Array[Byte])spray.http.HttpEntity <and>
[error] (string: String)spray.http.HttpEntity
[error] cannot be applied to (spray.http.MediaType, String)
[error] entity = HttpEntity(`text/html`,
[error] ^
[error] /home/dkowis/gitwork/turbo-jug-robot/src/main/scala/spray/examples/DemoService.scala:18: not found: value Uri
[error] case HttpRequest(GET, Uri.Path("/ping"), _, _, _) =>
[error] ^
[error] /home/dkowis/gitwork/turbo-jug-robot/src/main/scala/spray/examples/DemoService.scala:21: not found: value Uri
[error] case HttpRequest(GET, Uri.Path("/stream"), _, _, _) =>
[error] ^
[error] /home/dkowis/gitwork/turbo-jug-robot/src/main/scala/spray/examples/DemoService.scala:25: not found: value Uri
[error] case HttpRequest(GET, Uri.Path("/crash"), _, _, _) =>
[error] ^
[error] /home/dkowis/gitwork/turbo-jug-robot/src/main/scala/spray/examples/DemoService.scala:30: not found: value Uri
[error] case HttpRequest(GET, Uri.Path("/timeout"), _, _, _) =>
[error] ^
[error] /home/dkowis/gitwork/turbo-jug-robot/src/main/scala/spray/examples/DemoService.scala:33: not found: value Uri
[error] case HttpRequest(GET, Uri.Path("/timeout/timeout"), _, _, _) =>
[error] ^
[error] /home/dkowis/gitwork/turbo-jug-robot/src/main/scala/spray/examples/DemoService.scala:38: not found: value Timedout
[error] case Timedout(HttpRequest(_, Uri.Path("/timeout/timeout"), _, _, _)) =>
[error] ^
[error] /home/dkowis/gitwork/turbo-jug-robot/src/main/scala/spray/examples/DemoService.scala:41: not found: value Timedout
[error] case Timedout(request: HttpRequest) =>
[error] ^
[error] /home/dkowis/gitwork/turbo-jug-robot/src/main/scala/spray/examples/DemoService.scala:42: not found: value request
[error] sender ! HttpResponse(500, "The " + request.method + " request to '" + request.uri + "' has timed out...")
[error] ^
[error] /home/dkowis/gitwork/turbo-jug-robot/src/main/scala/spray/examples/DemoService.scala:72: value withAck is not a member of spray.http.ChunkedResponseStart
[error] client ! ChunkedResponseStart(HttpResponse(entity = " " * 2048)).withAck(Ok(count))
[error] ^
[error] /home/dkowis/gitwork/turbo-jug-robot/src/main/scala/spray/examples/DemoService.scala:85: value withAck is not a member of spray.http.MessageChunk
[error] client ! MessageChunk(DateTime.now.toIsoDateTimeString + ", ").withAck(Ok(remaining - 1))
[error] ^
[error] 12 errors found
[error] (compile:compile) Compilation failed
[error] Total time: 4 s, completed May 25, 2013 1:32:40 PM
我真的不知道什么是正确的依赖关系,而且它们并没有在spray.io site上完全拼写出来。或者我很蠢,无法弄清楚依赖是什么。
答案 0 :(得分:0)
Aha,事实证明git master分支中有更新的,更改的内容,因此这些示例对任何已发布的工件都无效。在回购中使用标签,在我的情况下,1.1-M7让一切都快乐了。
Herp derp。