我正在使用 Scala 3 和 SBT 构建 Akka HTTP 项目。
在我将下面的新依赖项添加到
build.sbt
之前,应用程序运行良好。
添加的新依赖项有:
akka-http-circe
、akka-http-json4s
、authentikat-jwt
、json4s-native
、circe-generic
、slf4j-simple
。
我立即将新的依赖项添加到
build.sbt
,我开始收到错误:
Note: Unresolved dependencies path:
not found: C:\Users\hp\.ivy2\localde.heikoseeberger\akka-http-circe_2.13\1.27.0\ivys\ivy.xml
not found: https://repo1.maven.org/maven2/de/heikoseeberger/akka-http-circe_2.13/1.27.0/akka-http-circe_2.13-1.27.0.pom
not found: https://repo.akka.io/maven/de/heikoseeberger/akka-http-circe_2.13/1.27.0/akka-http-circe_2.13-1.27.0.pom
Error downloading de.heikoseeberger:akka-http-circe_2.13:1.27.0
``
我添加到
build.sbt
的所有其他新依赖项都会出现类似的错误。
我认为这是 scala3 兼容性问题,这就是为什么我向每个新依赖项添加
.cross(CrossVersion.for3Use2_13)
。
但问题仍然存在。
可能是什么问题?
提前致谢!
添加了新的依赖项:
("com.typesafe.scala-logging" %% "scala-logging" % "3.9.0").cross(CrossVersion.for3Use2_13),
("de.heikoseeberger" %% "akka-http-circe" % "1.27.0").cross(CrossVersion.for3Use2_13),
("de.heikoseeberger" %% "akka-http-json4s" % "1.22.0").cross(CrossVersion.for3Use2_13),
("com.jason-goodwin" %% "authentikat-jwt" % "0.4.5").cross(CrossVersion.for3Use2_13),
("org.json4s" %% "json4s-native" % "3.6.1").cross(CrossVersion.for3Use2_13),
("io.circe" %% "circe-generic" % "0.11.1").cross(CrossVersion.for3Use2_13),
("org.slf4j" %% "slf4j-simple" % "1.7.25").cross(CrossVersion.for3Use2_13),
build.sbt:
lazy val akkaHttpVersion = "10.6.3"
lazy val akkaVersion = "2.9.4"
resolvers += "Akka library repository".at("https://repo.akka.io/maven")
fork := true
lazy val root = (project in file(".")).
settings(
inThisBuild(List(
organization := "com.example",
scalaVersion := "3.3.3"
)),
name := "eskimi-bidding-agent",
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-actor-typed" % akkaVersion,
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
"com.typesafe.akka" %% "akka-pki" % akkaVersion,
("com.typesafe.scala-logging" %% "scala-logging" % "3.9.0").cross(CrossVersion.for3Use2_13),
("de.heikoseeberger" %% "akka-http-circe" % "1.27.0").cross(CrossVersion.for3Use2_13),
("de.heikoseeberger" %% "akka-http-json4s" % "1.22.0").cross(CrossVersion.for3Use2_13),
("com.jason-goodwin" %% "authentikat-jwt" % "0.4.5").cross(CrossVersion.for3Use2_13),
("org.json4s" %% "json4s-native" % "3.6.1").cross(CrossVersion.for3Use2_13),
("io.circe" %% "circe-generic" % "0.11.1").cross(CrossVersion.for3Use2_13),
("org.slf4j" %% "slf4j-simple" % "1.7.25").cross(CrossVersion.for3Use2_13),
"ch.qos.logback" % "logback-classic" % "1.2.11",
"com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion % Test,
"com.typesafe.akka" %% "akka-actor-testkit-typed" % akkaVersion % Test,
"org.scalatest" %% "scalatest" % "3.2.12" % Test
)
)
检查您的版本。
例如 akka-http-circe 1.27.0 未针对 2.13 发布,因此您无法使用
for3Use2_13
。 2.13 akka-http-circe 自 1.28.0 起发布
https://mvnrepository.com/artifact/de.heikoseeberger/akka-http-circe
同样,scala-logging 3.9.0 也没有针对 2.13 发布。 2.13 是从 3.9.3 开始发布的
https://mvnrepository.com/artifact/com.typesafe.scala-logging/scala-logging
有 scala 日志记录
_3
https://repo1.maven.org/maven2/com/typesafe/scala-logging/scala-logging_3/
等等