Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to set the Scala version used in an Ammonite script?

Is there a way to set the Scala version used in an Ammonite script?

I've just started using Ammonite and at first blush it seems far superior to the scalas script runner that I've been using up until now. With scalas, however, I can easily set the Scala version used in the script. E.g.,

#!/usr/bin/env scalas

/***
scalaVersion := "2.11.8"
*/

I can't find any reference to any similar declaration in the Ammonite documentation.

like image 488
Douglas Avatar asked Dec 13 '16 19:12

Douglas


1 Answers

When the question was originally posted, there was no way with Ammonite to specify the version of Scala that you wanted to use. The Scala version was hardwired to 2.12.1 at the time.

There is still no way to set the version of Scala that you would like inside an Ammonite script, like you can with scalas. Fortunately, Ammonite is distributed in three different versions. You can download a Scala 2.12 version of Ammonite, if you would like. There are also Scala 2.11, and Scala 2.10 versions available for download.

https://ammonite.io/#OlderScalaVersions

like image 130
Douglas Avatar answered Nov 03 '22 02:11

Douglas