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

Scala Play集成ReactiveMongo失败:依赖未找到问题求助

Fixing the "UNRESOLVED DEPENDENCIES" Error with ReactiveMongo & Play Framework

Hey there, let's work through why you're hitting that frustrating unresolved dependency error. The core issue here is a version mismatch between Scala, Play Framework, and ReactiveMongo—let's break it down and fix it step by step.

Why This Error Happens

The dependency you're trying to use:

org.reactivemongo#play2-reactivemongo_2.12;0.11.7.play24

doesn't exist in any public repository, and here's the breakdown:

  • The 0.11.7.play24 suffix tells us this ReactiveMongo version is built exclusively for Play 2.4.
  • Play 2.4 only supports Scala 2.10 and 2.11—there's no official build of Play 2.4 that works with Scala 2.12.
  • So combining Scala 2.12 with Play 2.4 + ReactiveMongo 0.11.7 is an incompatible mix that simply doesn't exist.

Solutions to Fix the Error

Option 1: Stick with Play 2.4 (Downgrade Scala)

If you want to keep using Play 2.4, you'll need to switch your project to Scala 2.11.x (the latest stable release is 2.11.12):

  1. Update your build.sbt to set the correct Scala version:
    scalaVersion := "2.11.12"
    
  2. Adjust your ReactiveMongo dependency to match (using %% lets sbt auto-apply the Scala version suffix):
    libraryDependencies += "org.reactivemongo" %% "play2-reactivemongo" % "0.11.7.play24"
    

Option 2: Keep Scala 2.12 (Upgrade Play Framework)

If you want to stay on Scala 2.12, you need to upgrade Play to a version that supports it. Play 2.5+ works with Scala 2.12, but we recommend a newer, supported release like Play 2.6, 2.7, or 2.8. Here's how to match ReactiveMongo versions:

  • Play 2.6 → ReactiveMongo 0.12.7.play26
  • Play 2.7 → ReactiveMongo 0.18.1.play27
  • Play 2.8 → ReactiveMongo 1.0.10.play28

For example, if you upgrade to Play 2.8, your dependency would look like this:

libraryDependencies += "org.reactivemongo" %% "play2-reactivemongo" % "1.0.10.play28"

Quick Check: Verify Your Resolvers

Make sure your build.sbt includes the ReactiveMongo releases repository—this ensures sbt can locate the dependency:

resolvers += "ReactiveMongo Releases" at "https://releases.reactivemongo.org/releases"

Final Note

Always double-check that your Scala, Play, and ReactiveMongo versions align. ReactiveMongo's version naming follows a strict pattern: [reactivemongo-version].play[play-version], so you can easily match them up for compatibility.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 07:12:53