scalasbt

Scala SBT Version Dependency Binary Compatibility Error scala-xml


I have a project that I host on GitHub and I use scala-steward to keep my plugins and dependencies up to date. This worked for a while and now it is turning out to be a nightmare to use such auto updates. Here is the thing. In my plugins.sbt, I have a dependency to scoverage which was updated by scala-steward to version 2.0.6. But the pull request failed to pass through the compile stage and I see the following error:

[error] (update) found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[error] 
[error]     * org.scala-lang.modules:scala-xml_2.12:2.1.0 (early-semver) is selected over {1.3.0, 1.2.0, 1.1.1, 1.0.6}
[error]         +- org.scoverage:scalac-scoverage-reporter_2.12:2.0.7 (depends on 2.1.0)
[error]         +- org.scalariform:scalariform_2.12:0.2.0             (depends on 1.0.6)
[error]         +- org.scala-lang:scala-compiler:2.12.16              (depends on 1.0.6)
[error]         +- com.typesafe.sbt:sbt-native-packager:1.5.2 (scalaVersion=2.12, sbtVersion=1.0) (depends on 1.1.1)
[error]         +- com.typesafe.play:twirl-api_2.12:1.5.1             (depends on 1.2.0)
[error]         +- com.github.sbt:sbt-native-packager:1.9.9 (sbtVersion=1.0, scalaVersion=2.12) (depends on 1.3.0)
[error] 

First of all, it is good that such incompatibilities are reported during compile time to avoid any runtime surprises. But, I'm not sure how to get this fixed. Feels like I have hit a roadblock.

EDIT: Here is my actual project: https://github.com/joesan/plant-simulator


Solution

  • I had to do the following in my project/plugins.sbt file to get this error fixed:

    ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
    

    I also added the following to my build.sbt:

    ThisBuild / evictionErrorLevel := Level.Info
    

    But I guess I do not need that in my build.sbt. Hope this helps someone! The Scala community at discord helped me to get this fixed. Thanks to them!