How does sbt choose which Scala version to use?

前端 未结 2 904
小鲜肉
小鲜肉 2020-12-17 10:08

I have multiple projects in my sbt build. I\'m trying to upgrade to Scala 2.10 from 2.9.1, so in my build.sbt file I put

scalaVersion := \"2.10.0\"
         


        
相关标签:
2条回答
  • 2020-12-17 10:57

    SBT has a default Scala version. You need to add the scalaVersion setting to all subprojects if you wish to change it. The most common way of doing that is having a "common settings" value that is added to all projects at the root level, through project/Build.scala.

    0 讨论(0)
  • 2020-12-17 11:03

    I found out scoping the scalaVersion to ThisBuild will set it for all sub-projects. Details are here: http://www.scala-sbt.org/release/docs/Getting-Started/Multi-Project.html at the bottom, but here is what it says:

    To set it only once, it is enough to write, in the main build.sbt file, the following line:

    scalaVersion in ThisBuild := "2.10.0"
    
    0 讨论(0)
提交回复
热议问题