我有一个在 scala 2.13.1 上构建的 sbt Scala 项目我想用 scala-2.12.8 构建它,因为在做了一些研究之后,一些库依赖项仅支持 scala 2.12这个问题正是我的用例我遵循了答案但我我收到一个错误
error] scala.MatchError: Some((2,13)) (of class scala.Some)
[error] at $97a4428383eb69f53d6e$.$anonfun$$sbtdef$1(/home/sara/git/gitinterpret/interpret/build.sbt:56)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.EvaluateSettings$MixedNode.evaluate0(INode.scala:221)
[error] at sbt.internal.util.EvaluateSettings$INode.evaluate(INode.scala:164)
[error] at sbt.internal.util.EvaluateSettings.$anonfun$submitEvaluate$1(INode.scala:87)
[error] at sbt.internal.util.EvaluateSettings.sbt$internal$util$EvaluateSettings$$run0(INode.scala:98)
[error] at sbt.internal.util.EvaluateSettings$$anon$3.run(INode.scala:94)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error] at java.base/java.lang.Thread.run(Thread.java:834)
[error] scala.MatchError: Some((2,13)) (of class scala.Some)
[error] Use 'last' for the full log.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
这是我的 build.sbt
lazy val scala212 = "2.12.8"
lazy val scala213 = "2.13.1"
scalaVersion := scala213
lazy val supportedScalaVersions = List(scala213, scala212)
lazy val root = (project in file("."))
.settings(
crossScalaVersions := supportedScalaVersions,
)
libraryDependencies := { CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2,scalaMajor)) if scalaMajor == 12.8 =>
libraryDependencies.value ++ Seq(
"org.scala-lang" % "scala-library" % "2.12.8",
"org.mongodb.scala" %% "mongo-scala-driver" % "2.8.0"
"io.gatling.highcharts" % "gatling-charts-highcharts" % "3.3.1" % "test"
case Some((2,scalaMajor)) if scalaMajor == 13.1 =>
libraryDependencies.value ++ Seq(
"org.scala-lang" % "scala-library" % "2.13.1",
"org.mongodb.scala" %% "mongo-scala-driver" % "2.8.0",
"com.typesafe.akka" %% "akka-actor" % "2.6.3",
)
}
}