Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upgrade Scala to a newer version from the command line?

Tags:

scala

sbt

Is there away to upgrade the installed Scala version via sbt / other command line tool?

I'm sure there is a way, but I couldn't find any after a quick search, am I missing anything?

like image 256
Eran Medan Avatar asked Jan 30 '13 21:01

Eran Medan


People also ask

How do I install latest version of Scala?

Install it on your system with the following instructions. Download and execute the Scala installer for Windows based on Coursier, and follow the on-screen instructions. JavaScript is disabled, click the tab relevant for your OS. Follow the documentation from Coursier on how to install and run cs setup .

What version of Scala do I have Mac terminal?

Check Scala Version Using scala CommandWrite the scala command to your terminal and press enter. After that, it opens Scala interpreter with a welcome message and Scala version and JVM details.


2 Answers

Each SBT project specifies the version of Scala to use to compile and run its code. It defaults to being the version of Scala that SBT uses internally, but is always overridable.

E.g.

  scalaVersion := "2.10.0"

As Connor Doyle mentioned, if your OS has a package system that includes Scala (some Linux distros I know of do) and you are, for some reason obligated to use that, you are pretty much at their mercy to provide a new version on a timely basis. The Scala Web Site (downloads here) provides a variety of installers and tarballs / Zip archives for every release they've made.

Mac OS X users can use HomeBrew to get up-to-date SBT and Scala.

like image 122
Randall Schulz Avatar answered Oct 15 '22 05:10

Randall Schulz


To set the project version temporarily from the command line:

++ 2.10.4

To set the project version permanently from the command line:

set scalaVersion := "2.10.4"
session save
like image 21
GatesDA Avatar answered Oct 15 '22 05:10

GatesDA