set different scala version for projects in dependsOn

36 views
Skip to first unread message

Hongwei Liu

unread,
Dec 15, 2015, 8:04:26 PM12/15/15
to simple-build-tool
hi ,

i have a project which depends on other projects. but each use different scala version:

// build.sbt
name := "app"
scalaVersion := "2.10.4"
lazy val sdk = RootProject(file("./../../sdk"))
lazy val libs = RootProject(file("./../../libs"))
lazy val app = RootProject(file(".")).dependsOn(sdk, libs)


but the scalaVersion in sdk is "2.11.6", in libs is "2.12.0"

so if i build directly "sbt compile" , it will fail as it unable to find the version of "2.10" for sdk and libs.

i tried as below 2 ways, but neither worked:

1. i want to set the versions for the project reference here like this:

lazy val sdk = RootProject(file("./../../sdk")).settings(scalaVersion :="2.11.6")
lazy val libs = RootProject(file("./../../libs")).settings(scalaVersion :="2.12.0")

but the RootProject is a ProjectReference object which does not has "settings" method.

2. set scalaVersion in scope

 scalaVersion in sdk := "2.11.6"
 scalaVersion in libs := "2.12.0"


can someone help me on this? how to correct set the versions to support cross version build?

Thanks
Hongwei



Reply all
Reply to author
Forward
0 new messages