Error upgrading to Scala 2.13.6

I am trying to migrate to Scala - 2.13.6 and Akka - 2.6.16 with akka-actor_2.13 version 2.6.16.

Code

import akka.http.scaladsl.model.ContentType
import akka.http.scaladsl.model.HttpCharsets.UTF-8
import akka.http.scaladsl.model.MediaTypes.{application/json, application/xml}

object MyPayloadType extends Enumeration {

val XML,
JSON = Value

def getMyPayloadType(contentType: Value): ContentType.NonBinary = contentType match {

case XML => ContentType(`application/xml`, `UTF-8`)

case JSON => ContentType(`application/json`)

}
}

Above code gives the following compilation error.
"Symbol ‘type Scala.collection.IndexedSeqOptimized’ is missing from the classpath.
This symbol is required by ‘class akka.util.ByteString’

Please suggest to resolve above.

My first guess would be that you have a mixture of Scala 2.12 and Scala 2.13 based JARs on your classpath.

also asked at akka - Unable to upgrade to Scala 2.13.6 - Stack Overflow

Yes. I do have some dependencies referring to Scala 2.11. These dependencies don’t have scala compatible version 2.13. So, it didn’t migrate. The following are the two dependencies

de.heikoseeberger.constructr_2.11
com.tecsisa.constructr-coordination-consul_2.11

For above, latest Scala compatible version is 2.12.

Does this mean that for me I can migrate to Scala 2.12 only?

Yes, all your dependencies must be compiled for the same Scala binary version (ie. must have the same version suffix).

Note, that constructr is basically abandoned since 2018:

Given the bootstrapping capabilities of Akka Management, I don’t think ConstructR adds any value any longer. At least not to me.

See Retirement · Issue #179 · hseeberger/constructr · GitHub

Thanks! Have moved all the dependencies to Scala 2.12 which resolved the issue.