Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SBT: how to use scala 2.11 libraries in scala 2.12 project

Tags:

scala

sbt

I'm trying to upgrade my project to use scala 2.12 However, I use some libraries, which don't have 2.12 versions (mongoquery-casbah, salat).

If I force to use 2.11 versions of those libraries ("com.github.salat" % "salat_2.11" % "1.10.0", "com.github.limansky" % "mongoquery-casbah_2.11" % "0.5"), I get error:

[error] Modules were resolved with conflicting cross-version suffixes in {file:/C:/work/GeneASS/}dao:
[error]    org.scala-lang.modules:scala-parser-combinators _2.11, _2.12

How can I resolve this problem?

like image 939
Pavel Bernshtam Avatar asked Feb 05 '23 21:02

Pavel Bernshtam


1 Answers

The only way is to recompile the library for scala 2.12. This of course requires that any transitive dependencies of the library are also 2.12 compatible.

Scala source code is mostly compatible between versions but compiled byte code is not so you need to build a seperate artifact for every scala version you want to support.

like image 198
puhlen Avatar answered Feb 16 '23 21:02

puhlen