我在多项目sbt中有一个scala跨版本设置。在一个项目中,我试图禁用针对其中一种scala版本的构建,因为它依赖于2.10不支持的akka-http。
我尝试从该crossScalaVersions
字段中删除特定版本,但sbt仍尝试针对2.10构建它。我怀疑这是因为该项目依赖于另一个同2.10交叉构建的同级项目
sbt看起来像这样(为便于阅读而缩写):
lazy val commonSettings = Seq(
........... Common settings ................
)
// aggregate root project
lazy val root = project.in(file(".")).aggregate(
anotherSiblingProject,
service
).settings(commonSettings)
lazy val anotherSiblingProject: Project = project.in(file("anotherSiblingProject"))
.settings(
commonSettings,
crossScalaVersions := Seq("2.10.4", "2.11.11", "2.12.2"), <<<< BUILDS AGAINST ALL OF THESE
)
// WANT TO REMOVE THE CROSS BUILD FOR THiS
lazy val service: Project = project.in(file("service"))
.dependsOn(anotherSiblingProject)
.settings(
commonSettings,
crossScalaVersions := Seq("2.11.11"), <<<<<< ONLY WANT TO BUILD AGAINST THIS VERSION
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-http" % "10.1.4",
"com.typesafe.akka" %% "akka-stream" % "2.5.12",
"com.typesafe.akka" %% "akka-http-spray-json" % "10.1.4",
"com.typesafe.scala-logging" %% "scala-logging" % "3.4.0"
)
)
答案 0 :(得分:1)
我想您的scalaVersion
中有commonSettings
。
因此,您可以从crossScalaVersions
中删除service
并显式编译诸如sbt '++ 2.11.11 anotherSiblingProject/compile' 'service/compile'