Home > Net >  Cross Compiling a Scala Project Results in Error
Cross Compiling a Scala Project Results in Error

Time:12-08

I have a multi module Scala project that I'm cross compiling to Scala 2.11, 2.12, 2.13 and 3.1. I have all the build.sbt set up, but for one of the dependencies that is used for test, there is not yet a Scala 3.x version published. How do I deal with such situations? Here is it:

val specs2Mock = "org.specs2" %% "specs2-mock" % "4.19.0" % "test"

As it can be seen that only upto Scala 2.13 is published:

https://mvnrepository.com/artifact/org.specs2/specs2-mock

How could I go about with this? Does this mean that as long as I do not have a Scala 3.x version of the specs-mock, I could not compile my project to Scala 3? Is there a work around? Any ideas?

CodePudding user response:

I had to do the following:

val specs2 = "org.specs2" %% "specs2-core" % specs2V % "test" cross CrossVersion.for3Use2_13
val specs2Mock = "org.specs2" %% "specs2-mock" % specs2V % "test" cross CrossVersion.for3Use2_13

Make sure that all the specs2 library is asked to use Scala 2.13.

  • Related