1

我的 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 网站上准确说明。或者我很笨,无法弄清楚依赖关系是什么。

4

1 回答 1

0

啊哈,事实证明 git master 分支具有更新的、破坏性的更改,因此这些示例对任何已发布的工件都无效。在 repo 中使用标签,在我的例子中 1.1-M7 让一切再次变得愉快。

疱疹病毒。

于 2013-05-25T19:46:39.293 回答