Scala sbt "Conflicting cross-version suffixes" (_2.12 vs _2.13) in CI
sbt detected the same module on the classpath compiled for two different Scala binary versions (for example _2.12 and _2.13). Mixing Scala binaries is unsafe, so it fails the build instead of linking them.
What this error means
sbt update fails with "[error] Conflicting cross-version suffixes in: <org>:<name>: _2.12, _2.13", naming the module pulled in for both binaries.
sbt
[error] Modules were resolved with conflicting cross-version suffixes in ProjectRef(...):
[error] com.typesafe.akka:akka-actor _2.12, _2.13
[error] sbt.librarymanagement.EvictionWarningOptions ...Common causes
A hardcoded suffix pins the wrong binary
A dependency written with % and a literal name_2.12 pulls the 2.12 build while the project compiles for 2.13.
A transitive dependency targets another Scala binary
A library built against a different Scala version drags in _2.12 artifacts alongside your _2.13 ones.
How to fix it
Use %% so the suffix follows the project
- Find the dependency with a literal
_2.12/_2.13suffix. - Replace
%plus the suffixed name with%%and the bare name. - Re-run
sbt updateso a single binary version resolves.
build.sbt
// before: "com.typesafe.akka" % "akka-actor_2.12" % "2.6.20"
libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.6.20"Align scalaVersion with the dependencies
When a needed library only ships for one binary, set scalaVersion to that binary so everything matches.
build.sbt
scalaVersion := "2.13.14"How to prevent it
- Always use
%%for Scala libraries so the binary suffix is automatic. - Keep
scalaVersionconsistent across subprojects. - Inspect
evictedoutput when adding cross-built dependencies.
Related guides
Scala sbt "ResolveException: unresolved dependency" in CIFix Scala sbt "sbt.librarymanagement.ResolveException: Error downloading / unresolved dependency" in CI - the…
Scala sbt "object X is not a member of package Y" in CIFix Scala "[error] object X is not a member of package Y" in CI - an import points at a package path that the…
Scala sbt "not found: value/object X" in CIFix Scala "[error] not found: value X" or "not found: object X" in CI - the compiler reached an identifier it…