【问题标题】:Issue importing Akka packages导入 Akka 包的问题
【发布时间】:2017-04-18 21:26:14
【问题描述】:

我有以下build.sbt 文件:

name := "akkaHttp"

version := "1.0"

scalaVersion := "2.12.0"


resolvers ++= Seq("Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/",
  Resolver.bintrayRepo("hseeberger", "maven"))


libraryDependencies ++= {
  val AkkaVersion       = "2.3.9"
  val AkkaHttpVersion   = "2.0.1"
  val Json4sVersion     = "3.2.11"
  Seq(
    "com.typesafe.akka" %% "akka-slf4j"      % AkkaVersion,
    "com.typesafe.akka" %% "akka-http-experimental" % AkkaHttpVersion,
    "ch.qos.logback"    %  "logback-classic" % "1.1.2",
    "org.json4s"        %% "json4s-native"   % Json4sVersion,
    "org.json4s"        %% "json4s-ext"      % Json4sVersion,
    "de.heikoseeberger" %% "akka-http-json4s" % "1.4.2"
  )
}

在里面,这些依赖都没有满足。

Error:Unresolved dependencies:
com.typesafe.akka#akka-slf4j_2.12;2.3.9: not found
com.typesafe.akka#akka-http-experimental_2.12;2.0.1: not found
org.json4s#json4s-native_2.12;3.2.11: not found
org.json4s#json4s-ext_2.12;3.2.11: not found
de.heikoseeberger#akka-http-json4s_2.12;1.4.2: not found

那么我应该添加什么以使导入起作用?

【问题讨论】:

  • AFAIK ,akka 2.3.9 尚未在 maven 中针对 2.12 构建和发布。它可用于 scala 2.11.x 。尝试使用 scala 版本作为 2.11.8 。

标签: scala sbt akka


【解决方案1】:

注意到附加到工件的_2.12 了吗?根据您的scalaVersion,SBT 尝试下载针对 Scala 2.12.x 构建的依赖项,但找不到任何依赖项。尝试使用 Scala 版本 2.11.8。

不同版本的 Scala 可能是二进制不兼容的,因此库针对这些不同版本交叉构建并发布到存储库。看起来上面的那些库还没有发生。

请注意,Scala 2.12 确实是 not binary compatible 与 Scala 2.11。

【讨论】:

    猜你喜欢
    • 2019-04-25
    • 2017-07-22
    • 2011-09-15
    • 1970-01-01
    • 2022-07-04
    • 2012-11-02
    • 2023-04-08
    • 1970-01-01
    相关资源
    最近更新 更多