How can I change version of Scala that is used by Play, SBT and its plugins?

后端 未结 2 1614
小蘑菇
小蘑菇 2021-02-05 16:08

Is it necessary to change version of Scala that is used by SBT and its plugins ?

I\'m using Play Framework 2.1.1-RC2. I want to create new project that will use Scala 2.

2条回答
  •  盖世英雄少女心
    2021-02-05 16:37

    The ultimate goal of my experiments was to change version of Scala compiler used to build my project.

    After multiple attempts I concluded that achieving it nicely not possible. I think it's something creators of Play Framework should address.

    Setting scalaVersion to 2.10.1-local in Build.scala didn't help much. SBT seem to be going to Maven/Ivy and downloading pieces of 2.10.0 that I don't want. After compiling the app I get bunch of warnings about incompatible dependencies.

    I think it happens because {PLAY_HOME}\framework\project\Build.scala has bunch of variable set to 2.10.0.

    "Elegant" solution was to tell SBT I'm going to use local copy of Scala by setting following variables in Build.scala

    scalaVersion := "2.10.1-local",
    autoScalaLibrary := false,
    scalaHome := Some(file("/Program Files (x86)/scala/"))
    

    But still if I create IntelliJ IDEA configuration with play idea command resulting project needs some clean up, in particular:

    • Scala facet references missing Scala 2.10.0 library.
    • Module test3-build has dependency on missing Scala 2.9.2 library

    I hope my experiments other people who are also learning Play and Scala.

    Details are here: http://www.scala-sbt.org/release/docs/Howto/scala.html

提交回复
热议问题