How to have SBT subproject with multiple Scala versions?

后端 未结 3 1586
感情败类
感情败类 2021-02-04 08:28

I have a project using Scala 2.10 and one using Scala 2.11. They depend on a common project, which can compile with both.

lazy val foo = (project in file(\"foo\"         


        
3条回答
  •  半阙折子戏
    2021-02-04 09:08

    I had a similar setup, and got it work like so:

    lazy val baz = (project in file("baz")).settings(
      crossScalaVersions := Seq("2.10.4", "2.11.4")
    )
    lazy val bar = (project in file("bar")).dependsOn(baz).settings(
      scalaVersion := "2.10.4"
    )
    lazy val foo = (project in file("foo")).dependsOn(baz).settings(
      scalaVersion := "2.11.4"
    )
    

    And building with

    sbt '++ 2.10.4 baz/compile' 'bar/compile' '++ 2.11.4 baz/compile' 'foo/compile'
    

提交回复
热议问题