上QQ阅读APP看书,第一时间看更新
Tips for installing Scala using SBT
You can also experiment with any Scala version using SBT. To do this, you should:
- Download and install SBT: https://www.scala-sbt.org/download.html.
- Open a Terminal and run sbt.
- In the SBT shell, type ++ 2.12.4 or any version you want to try. Please note that if the currently used Scala version is not binary compatible with the one you want to use, you will have to modify the command to the following—++ 2.12.4!. Binary compatibility is very important in Scala and you should try and make sure they use libraries written in the same version of Scala as they use. Otherwise, you might get into trouble.
- Issue the console command and you will be in a Scala shell running the version of your choice.
All the examples in this book use SBT or Maven (depending on your preferences). They are build and dependency management tools, which means that you might not even need to do anything extra to install Scala. You can just import an example project and everything will be taken care of automatically.