I'm pretty new to scala. While upgrading a multi-module project to Scala 2.13, I found this dependency that is compiled in Scala 2.12 which throws class not found
exception during runtime
java.lang.NoClassDefFoundError: scala/collection/mutable/ArrayOps$ofRef
This class is removed in 2.13. It is available only until 2.12. I am looking for a way to enforce v2.12 to compile only this dependency.
I tried to use cross-building but that does not work for a core library, because the dependency url constructed using:
"org.scala-lang" % "scala-library" % scalaVersion.value
looks like
https://repo1.maven.org/maven2/org/scala-lang/scala-library_2.12.15/2.12.15/scala-library_2.12.15-2.12.15.pom
Also, cross-building seems to be the way to allow compiling sub-modules with different scala versions with their compatible dependency versions, not meant for enforcing scala versions on individual dependencies.
Edit 1: This is the build definition:
root
|
main
|---dependency w/o 2.13 build
|
acceptanceTests
|---dependency w/o 2.13 build
|
(other modules)
The dependency is an internal commons library. This uses the class scala/collection/mutable/ArrayOps during compile time. From scala-lang -> scala-library.
My questions:
- Is it even possible to do this? Or is my only option to downgrade to 2.12 as mentioned here
- Why 'core' libraries do not follow the url patters of external libraries like:
[organisation]/[module](_[scalaVersion])(_[sbtVersion])/[revision]
. `Instead it looks likehttps://repo1.maven.org/maven2/org/scala-lang/scala-library/2.12.15/scala-library-2.12.15.pom
You can do stuff like this: