【问题标题】:Add scala-async to library dependency but still get "not found: value async" error将 scala-async 添加到库依赖项,但仍然出现“未找到:值异步”错误
【发布时间】:2015-06-05 18:50:01
【问题描述】:

我有一个使用“异步”的简单函数:

def delay(t: Duration): Future[Unit] = async {
    blocking {
        Thread.sleep(t.toMillis)
    }
}

我已通过项目设置/库(来自 Maven)将以下 jar 添加到我的项目中:

SBT: org.scala-lang.modules:scala-async_2.11:0.9.2:jar

并且还在“build.sbt”中发现了这个依赖:

projectDetailsMap := {

  val depsNode = Seq(
    .......
    "org.scala-lang.modules" %% "scala-async" % "0.9.2"
  )}

但是当我重建项目,甚至重新启动Intellij并再次重建时,我仍然得到这个错误:

Error:(65, 44) not found: value async
    def delay(t: Duration): Future[Unit] = async {
                                           ^

谁能告诉我可能出了什么问题?非常感谢!

我在 Mac 上使用 scala "2.11.5"

【问题讨论】:

  • 你导入了吗? import scala.async.Async.{async, await}
  • 是的,Kolmar,我导入了它,但是没有用。

标签: scala maven asynchronous intellij-idea


【解决方案1】:

好吧,我重新安装了我的 Intellij IDEA,将“idea.properties”中的默认 JDK 1.6 更改为我当前的 JDK 1.8,并将我的项目再次导入为 SBT 项目。问题解决了。这可能是由于我的环境中的一些冲突引起的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-05-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-27
    • 2013-02-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多