-1

i am using scala 2.13 and i have to use Gatling load tests, Gatling does not support Scala-2.13 for that i looked into sbt cross build and how to cross build library dependency i have two Gatling dependencies

"io.gatling.highcharts" % "gatling-charts-highcharts" % "3.3.1",
    "io.gatling" % "gatling-test-framework" % "3.3.1"

these libraries support Scala 2.12 for that i am doing something like this build.sbt

lazy val scala212 = "2.12.10"

lazy val scala213 = "2.13.1"

scalaVersion := scala213

lazy val supportedScalaVersions = List(scala213, scala212)

lazy val root = (project in file("."))
  .settings(
    crossScalaVersions := supportedScalaVersions,
  )

libraryDependencies ++= Seq(
  "org.mongodb.scala" %% "mongo-scala-driver" % "2.8.0",
  "com.typesafe.akka" %% "akka-actor" % "2.6.3",
  "com.typesafe.akka" %% "akka-stream" % "2.6.3"
)

libraryDependencies ++= (scalaBinaryVersion.value match {
  case "2.12.10" => Seq(
    "io.gatling.highcharts" % "gatling-charts-highcharts" % "3.3.1",
    "io.gatling" % "gatling-test-framework" % "3.3.1"
  )
  case _ => Seq()
}
  )

Sbt is not downloading the Gatling dependencies and sbt update command does not show any error it looks like the case 2.12.10 match part is not even executed

what is the right way to do this ? i want to write Gatling simulations in test directory

swaheed
  • 3,671
  • 10
  • 42
  • 103

1 Answers1

1

You got it almost right but scalaBinaryVersion is 2.12 in your case. scalaVersion.value is what you are looking for.

bottaio
  • 4,963
  • 3
  • 19
  • 43