0
votes

I have a scala cross build setting in a multi project sbt. In one of the projects I am trying to disable building against one of the scala versions since it has a dependency on akka-http which isn't supported on 2.10.

I tried to remove the specific version from that crossScalaVersions field but sbt still tries to build it against 2.10. I suspect this is since this project is dependent on another sibling project that is cross build against 2.10

The sbt looks like this (abbreviated for legibility):

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"
    )
)
1

1 Answers

1
votes

I suppose that you have scalaVersion in your commonSettings. So you can removecrossScalaVersions from service and explicitly compile service like that sbt '++ 2.11.11 anotherSiblingProject/compile' 'service/compile'