You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行GitHub克隆的Scala程序时sbt run出现UNRESOLVED DEPENDENCIES警告

Understanding the Unresolved Dependency Warning & Fixes

First, let's break down exactly what's happening with those warnings:

  • The core problem is that sbt can't locate the specified Akka dependency versions: akka-actor_2.11;2.4-SNAPSHOT, akka-contrib_2.11;2.4-SNAPSHOT, and akka-testkit_2.11;2.4-SNAPSHOT.
  • SNAPSHOT versions are development-only "work-in-progress" builds. They’re almost never published to public repositories like Maven Central (the repo you see in the download logs), so sbt has no way to pull them down.
  • From the error path, these dependencies are either defined directly in your project’s build.sbt file, or are required by the actoverse-for-akka library your project depends on.

Here are actionable steps to fix this:

1. Replace SNAPSHOT versions with stable releases

Since you already successfully downloaded akka-stream_2.11-2.4.14, use that same stable version for the missing Akka dependencies:

  • Open your project’s build.sbt file.
  • Look for lines declaring these Akka dependencies, which will look similar to:
    libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.4-SNAPSHOT"
    libraryDependencies += "com.typesafe.akka" %% "akka-contrib" % "2.4-SNAPSHOT"
    libraryDependencies += "com.typesafe.akka" %% "akka-testkit" % "2.4-SNAPSHOT"
    
  • Replace "2.4-SNAPSHOT" with "2.4.14" for all three lines, matching the version of akka-stream that worked.

2. Fix dependencies from the third-party actoverse-for-akka library

If the SNAPSHOT dependencies are coming from actoverse-for-akka (not your own build.sbt):

  • Check if the actoverse-scala repository you cloned has recent updates. The maintainers might have already fixed this dependency issue—pull the latest code and try again.
  • If no updates are available, force sbt to use the stable 2.4.14 version by adding this to your build.sbt:
    dependencyOverrides ++= Seq(
      "com.typesafe.akka" %% "akka-actor" % "2.4.14",
      "com.typesafe.akka" %% "akka-contrib" % "2.4.14",
      "com.typesafe.akka" %% "akka-testkit" % "2.4.14"
    )
    
    This tells sbt to ignore the library’s requested SNAPSHOT version and use the stable one instead.

3. (Last resort) Add the snapshot repository (unlikely to work for old versions)

If you must use the 2.4-SNAPSHOT version (though this isn’t recommended for outdated releases), add the Sonatype snapshot repository to your build.sbt:

resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

Note: Older SNAPSHOT versions like 2.4-SNAPSHOT are often removed from repositories over time, so this might not work. Stick to stable releases first.

After making these changes, run sbt clean run to clear cached dependency data and try building again.

内容的提问来源于stack exchange,提问作者f_s

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 06:55:24