执行SBT时遇目录未找到及依赖解析失败问题求助
Hey there, let's break down what's going on here and how to fix it:
问题根源
The error you're seeing boils down to plugin version incompatibility. The project you downloaded (following a 2016 guide) uses sbt-pack version 0.3.6, which was built exclusively for the older sbt 0.13.x ecosystem. Your current environment is running sbt 1.0+ paired with Scala 2.12, and this outdated plugin version has no published build that supports these newer tool versions—hence the repeated "Not found" errors for the plugin's pom/ivy files.
修复方案
Here are three actionable ways to resolve this:
1. Upgrade the sbt-pack plugin (Recommended)
Locate the project/plugins.sbt file in your project directory, then replace the existing sbt-pack dependency line with a version that supports sbt 1.0+. For example:
addSbtPlugin("org.xerial.sbt" % "sbt-pack" % "0.16.0")
This version (0.16.0) is a stable release fully compatible with sbt 1.0+ and Scala 2.12. You can use a newer compatible version if you prefer, but this one will definitely fix the dependency issue.
2. Downgrade your sbt environment to 0.13.x
If you'd rather not modify the project's configuration, you can install sbt 0.13.x (which works with Scala 2.10/2.11) and re-run your commands. That said, this isn't ideal—sbt 0.13 is no longer maintained, so you might hit other compatibility roadblocks later.
3. Match the project's expected sbt version
Check the build.properties file in your project's root directory. It should specify the sbt version the project was originally built for, like:
sbt.version=0.13.17
If that's the case, you can either install that exact sbt version, or update this file to a newer sbt version (e.g., 1.9.6) and then upgrade all your plugins to match (starting with sbt-pack as in option 1).
Quick Recap
The 2016-era project relies on outdated tooling. The simplest and most future-proof fix is upgrading the sbt-pack plugin to a version that works with your current sbt/Scala setup.
内容的提问来源于stack exchange,提问作者M.m.mm




