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

Play生产环境打包时Scala版本依赖警告问题咨询

Fixing Scala Version Dependency Warning in SBT

Hey there, let's tackle that annoying version conflict warning you're getting when building your Play production environment with dist. Here's a step-by-step solution:

1. Add the forced Scala version override to your build.sbt

The warning already gives you the exact line you need—just add this snippet to your build.sbt file, right alongside your existing scalaVersion := "2.11.12" line:

ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }

This tells SBT to ignore any Scala version specified by your dependencies and strictly use the 2.11.12 version you've defined.

2. Verify the fix with the evicted command

To make sure the conflict is resolved, run this command in your SBT shell:

evicted

This will show you a detailed breakdown of all dependency version evictions. You should no longer see the warning about org.scala-lang:scala-compiler being updated from 2.11.0 to 2.11.8—instead, it should confirm that all Scala-related dependencies are aligned with your specified 2.11.12 version.

3. Optional: Double-check your dependencies (if issues persist)

If you still run into problems after adding the override, it's worth checking if any of your dependencies don't have a compatible build for Scala 2.11.12. You can:

  • Explicitly exclude conflicting Scala compiler/library dependencies from specific libraries using SBT's exclude method (e.g., libraryDependencies += "some.group" % "some-lib" % "1.0" exclude("org.scala-lang", "scala-compiler"))
  • Look for updated versions of your dependencies that explicitly support Scala 2.11.12

That should get rid of that warning for good when you run dist next time!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.20 12:07:19