我正在使用 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),
构建.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
https://mvnrepository.com/artifact/com.typesafe.scala-logging/scala-logging?repo=central
有 scala-logging
_3
https://repo1.maven.org/maven2/com/typesafe/scala-logging/scala-logging_3/ETC。