sbt "Conflicting cross-version suffixes" in CI
Two artifacts on the classpath were compiled for different Scala binary versions. sbt refuses to mix, for example, a _2.13 and a _3 build of the same module.
What this error means
update or eviction resolution fails with Conflicting cross-version suffixes in: ..., naming the artifact and the two suffixes. It is deterministic given the dependency set.
[error] java.lang.RuntimeException: Conflicting cross-version suffixes in:
[error] org.example:widget:_2.13, _3
[error] (use evicted to inspect)Common causes
A hardcoded suffix diverged from scalaVersion
A library was added with a literal _2.13 artifact name while the project moved to Scala 3, so the suffixes no longer agree.
A transitive dep pulls an incompatible build
A third-party library brings in another module built for a different Scala binary version than the rest of your build.
How to fix it
Use %% so suffixes follow scalaVersion
- Set a single
scalaVersionfor the project. - Use
%%for every Scala library so sbt appends the binary version automatically. - Remove any hardcoded
_2.13/_3artifact names.
Find the offending transitive dependency
Inspect the tree to locate which dependency pulls the wrong build.
sbt evicted
sbt "whatDependsOn org.example widget"Upgrade or exclude the lagging library
Move to a release published for your Scala binary version, or exclude the bad transitive and add the right one.
How to prevent it
- Standardize on one Scala version per build.
- Prefer %% over hardcoded suffixes.
- Review
sbt evictedafter dependency bumps.