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

IntelliJ中Scala sbt同步失败:添加Scalacheck后依赖缺失

Troubleshooting Scalacheck Dependency Sync Failures in IntelliJ

Let's work through this issue step by step—your build.sbt configuration looks correct, so the problem is likely with how IntelliJ is handling the sbt import or caching. Here are the most effective fixes:

  • Use the sbt panel refresh instead of File → Synchronize
    The File → Synchronize option only syncs file system changes, not sbt dependencies. Open the sbt tool window (go to View → Tool Windows → sbt if it's hidden), then click the circular refresh icon in the top toolbar. This triggers a proper sbt import that should pull in your test dependencies like Scalacheck.

  • Invalidate IntelliJ caches and restart
    Corrupted IDE cache is a common culprit here. Go to File → Invalidate Caches..., select the "Invalidate and Restart" option, and let IntelliJ reboot. This clears stale cache data that might be blocking dependency detection.

  • Pull dependencies manually via sbt first
    Open a terminal in your project root directory and run:

    sbt test:compile
    

    This forces sbt to download all test-scoped dependencies (including Scalacheck) directly. Once the command completes successfully, go back to IntelliJ and refresh the sbt project again.

  • Verify your sbt settings in IntelliJ
    Double-check that IntelliJ is using the correct sbt and Scala versions:

    1. Go to File → Settings → Build, Execution, Deployment → Build Tools → sbt
    2. Ensure the "Scala SDK" matches the scalaVersion in your build.sbt (2.12.6 in your case)
    3. Try toggling the "Use sbt shell for build and import" option (sometimes switching it off and back on resolves import bugs)
  • Check for network issues
    If the sbt test:compile command fails, you might have trouble accessing Maven Central. Verify your network connection, disable any proxies that might be blocking access, or check if your organization uses a private repository that requires additional configuration in build.sbt.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.26 10:05:35