akka Scala SBT无法下载依赖项

amrnrhlw  于 2022-11-06  发布在  Scala
关注(0)|答案(2)|浏览(180)

我是scala和Akka的新手。我已经创建了一个新的项目,下面是我的build.sbt文件。

name := "akka_essentials"

version := "0.1"

scalaVersion := "2.13.4"

val akkaVersion = "2.5.13"

libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-actor" % akkaVersion,
  "com.typesafe.akka" %% "akka-testkit" % akkaVersion,
  "com.scalatest" %% "scalatest" % "3.0.5"
)

sbt工具无法下载依赖项。错误日志如下:

[error] stack trace is suppressed; run 'last update' for the full output
[error] (update) sbt.librarymanagement.ResolveException: Error downloading com.typesafe.akka:akka-testkit_2.13:2.5.13
[error]   Not found
[error]   Not found
[error]   not found: C:\Users\Anand\.ivy2\local\com.typesafe.akka\akka-testkit_2.13\2.5.13\ivys\ivy.xml
[error]   not found: https://repo1.maven.org/maven2/com/typesafe/akka/akka-testkit_2.13/2.5.13/akka-testkit_2.13-2.5.13.pom
[error] Error downloading com.scalatest:scalatest_2.13:3.0.5
[error]   Not found
[error]   Not found
[error]   not found: C:\Users\Anand\.ivy2\local\com.scalatest\scalatest_2.13\3.0.5\ivys\ivy.xml
[error]   not found: https://repo1.maven.org/maven2/com/scalatest/scalatest_2.13/3.0.5/scalatest_2.13-3.0.5.pom
[error] Error downloading com.typesafe.akka:akka-actor_2.13:2.5.13
[error]   Not found
[error]   Not found
[error]   not found: C:\Users\Anand\.ivy2\local\com.typesafe.akka\akka-actor_2.13\2.5.13\ivys\ivy.xml
[error]   not found: https://repo1.maven.org/maven2/com/typesafe/akka/akka-actor_2.13/2.5.13/akka-actor_2.13-2.5.13.pom

我对scala很陌生。我还没有定义过像ivy.xml这样的东西。我来自java背景,一般使用gradle。
请建议解决此问题。

vu8f3i0k

vu8f3i0k1#

Akka 2.5.13还没有为Scala 2.13交叉发布,因为你可以check on Maven
支持2.13的最早版本是2.5.23(发布版,不是里程碑版或RC版)。您可以查看Actors here的版本矩阵。
因此,您需要使用较新的Akka或较旧的Scala。
在Scalatest中,您使用了错误的组织结构,它是"org.scalatest",而不是"com.scalatest"
如果您对依赖关系解决方案有疑问,请首先检查Maven。

pvcm50d1

pvcm50d12#

我做了以下更改以使其正常工作:

name := "project"

version := "0.1"

scalaVersion := "2.12.7"

val akkaVersion = "2.5.13"

libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-actor" % akkaVersion,
  "com.typesafe.akka" %% "akka-testkit" % akkaVersion
 // "com.scalatest" %% "scalatest" % "3.0.5"
)

相关问题