简体   繁体   English

scala:如何在 sbt 中交叉构建库依赖项

[英]scala: how to cross build the library dependency in sbt

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我正在使用scala 2.13 ,我必须使用Gatling 负载测试,Gatling 不支持Scala-2.13 ,因为我研究了sbt 交叉构建以及如何交叉构建库依赖项我有两个 Gatling 依赖项

"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这些库支持Scala 2.12因为我正在做这样的事情 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 Sbt没有下载 Gatling 依赖项并且sbt update命令没有显示任何错误,看起来case 2.12.10 match部分甚至没有执行

what is the right way to do this ?这样做的正确方法是什么? i want to write Gatling simulations in test directory我想在测试目录中编写加特林模拟

You got it almost right but scalaBinaryVersion is 2.12 in your case.你说得差不多了,但在你的情况下, scalaBinaryVersion2.12 scalaVersion.value is what you are looking for. scalaVersion.value是您正在寻找的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将scala sbt项目构建为Android库? - How to build an scala sbt project as Android library? 如何在构建时访问SBT / Scala构建中的库依赖项? - How to access library dependencies at build-time in SBT/Scala build? 如何将Kafka Streams的Scala API定义为build.sbt中的依赖项? - How to define Scala API for Kafka Streams as dependency in build.sbt? Scala sbt库依赖关系-找不到模块错误 - Scala sbt library dependency - module not found error 如何使用未发布的Scala标准库版本构建sbt? - How can I build in sbt with an unreleased version of the Scala standard library? Scala build.sbt:解决依赖关系递归 - Scala build.sbt: Solving dependency recursions 如何为与Build.scala位于同一目录中的Scala代码设置SBT依赖关系 - How to setup SBT dependency for scala code that is located in same directory as Build.scala 如何为 appJS/appJVM 交叉构建项目运行 scala sbt-native-packager - how to run scala sbt-native-packager for a appJS/appJVM cross-build project 如何从具有特定项目的交叉构建的SBT多项目中删除Scala版本 - How to remove scala version from an sbt multi project with cross build on a particular project 如何将库依赖项添加到Build.scala的类路径中? - How to add library dependency to classpath of Build.scala?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM