我从 akka.io 导入 Await 时出错。这是我的 build.sbt:
name := "Project1"
version := "0.1"
scalaVersion := "2.10.1"
libraryDependencies += "org.json4s" %% "json4s-native" % "3.2.4"
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies += "com.typesafe.akka" % "akka-actor_2.10" % "2.1.4"
这是代码的一部分:
import akka.actor.Actor
import akka.actor.ActorSystem
import akka.actor.Props
import akka.dispatch.Await
import akka.pattern.ask
//.......
private def resultId = {
private val someActor = context.actorSelection("../someActor123") // defined in Application object
val future = someActor ? SomeMessage
val result = Await.result(future, 1.timeout).asInstanceOf[String]
}
它说对象Await is not a member of package akka.dispatch
和value ? is not a member of akka.actor.ActorSelection
和not found: value Await
当然,我重新加载它并做了 gen-idea。