Home > database >  SBT binary incompatible issue scala-parser-combinators
SBT binary incompatible issue scala-parser-combinators

Time:11-19

I am new to the Scala env and trying to build a test project using play with 'scalikejdbc' for SQL integration. Here is my build.sbt following the documents at http://scalikejdbc.org/documentation/playframework-support.html

name := """run"""
organization := "com.example"

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

scalaVersion := "2.13.10"

libraryDependencies   = Seq(
    guice,
  "org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test,
  "com.h2database"  %  "h2"                           % "1.4.200", // your jdbc driver here
  "org.scalikejdbc" %% "scalikejdbc"                  % "4.0.0",
  "org.scalikejdbc" %% "scalikejdbc-config"           % "4.0.0",
  "org.scalikejdbc" %% "scalikejdbc-play-initializer" % "2.8.0-scalikejdbc-3.5",
  "com.typesafe.play" %% "play-ws" % "2.3.1"

)
dependencyOverrides  = "org.fluentlenium" % "fluentlenium-core" % "0.10.3"

// Adds additional packages into Twirl
//TwirlKeys.templateImports  = "com.example.controllers._"

// Adds additional packages into conf/routes
// play.sbt.routes.RoutesKeys.routesImport  = "com.example.binders._"

I have also aded the below on plugins.sbt

resolvers  = Resolver.url("SBT Plugins", url("https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)

However while trying to update the application before running i am getting the below issue

[error] (update) found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[error] 
[error]         * org.scala-lang.modules:scala-parser-combinators_2.13:2.1.0 (early-semver) is selected over {1.1.2}
[error]              - org.scalikejdbc:scalikejdbc-core_2.13:4.0.0        (depends on 2.1.0)
[error]              - com.typesafe.play:play_2.13:2.8.18                 (depends on 1.1.2)
[error]              - com.typesafe:ssl-config-core_2.13:0.4.3            (depends on 1.1.2)
[error] 

following are relevant versions :

sbt script version: 1.8.0
play version :2.8.18
Scala code runner version 3.2.1  but using as scalaVersion := "2.13.10" in sbt.

CodePudding user response:

version conflict(s) in library dependencies; some are suspected to be binary incompatible

This means that you have at least two dependencies that are needing a 3rd one but they need 2 different versions which are supposed to be incompatible.

As only one can be included and used for your code, SBT is telling you: "I am going to pick one version but there are risks that this version won't work as you might have code that rely on the other version and this might be incompatible".

You have 2 options:

  • force a version (for scala-parser-combinators) with dependencyOverrides for instance if you know that actually there's no incompatibility, or at least on the way you use the libraries
  • upgrade or downgrade the libraries (scalikejdbc or play) so that all libraries depend on the same version of the conflicting one (scala-parser-combinators).
    • In this case, I would downgrade scalikejdbc because there's no newer play version (as of today)
  • Related