I have a sbt project using sbt version 1.10.6 where I have set it to cross compile to 2.13.x and 3.1.x scala versions.
lazy val scala313 = "3.1.3"
lazy val scala2138 = "2.13.8"
lazy val supportedScalaVersions = List(scala313, scala2138)
I then set this explicitly for the release:
ThisBuild / scalaVersion := "3.1.3"
I then have this set in my build.sbt which is building a multi module sbt project. For one of those modules, I have the following:
lazy val ocppMessages =
module("ocpp-messages")
.settings(
name := """ocpp-messages""",
crossScalaVersions := supportedScalaVersions,
publish / skip := false
)
When I run my build, I get the following error:
error:
bad constant pool index: 0 at pos: 48462cremental 0s
while compiling: <no file>/ doc 0s
during phase: globalPhase=<no phase>, enteringPhase=<some phase>
library version: version 2.13.8
compiler version: version 2.13.8
[error] (ocpp-messages / Compile / compileIncremental) Error compiling the sbt component 'compiler-bridge_2.13'
[error] (ocpp-messages / Compile / doc) Error compiling the sbt component 'compiler-bridge_2.13'
Did I introduce any in-compatibilities with my Scala version that my path has which is Scala 3.2.0 and the associated sbt version?
There was a compatibility issue with the Scala, Sbt and Java versions. After updating my Scala version to 2.13.11 and 3.4.0 which seems to be the minimum requirement for Java 21, it worked! For reference here is the link to the version compatibilities:
https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html