Reputation: 577
I am trying to install SBT 0.13.6 version in my ubuntu. For this I do the following steps:
wget http://dl.bintray.com/sbt/debian/sbt-0.13.6.deb
sudo dpkg -i sbt-0.13.6.deb
sudo apt-get update
sudo apt-get install sbt
After installing, when I check the sbt version, it shows version 1.0.3.
Here is the command:
hadoop@localhost:~$ sbt about
Getting org.scala-sbt sbt 1.0.3 ...
:: retrieving :: org.scala-sbt#boot-app
confs: [default]
69 artifacts copied, 0 already retrieved (22027kB/913ms)
Getting Scala 2.12.4 (for sbt)...
:: retrieving :: org.scala-sbt#boot-scala
confs: [default]
5 artifacts copied, 0 already retrieved (18986kB/225ms)
[info] Loading project definition from /home/hadoop/project
[info] Set current project to hadoop (in build file:/home/hadoop/)
[info] This is sbt 1.0.3
[info] The current project is {file:/home/hadoop/}hadoop 0.1-SNAPSHOT
[info] The current project is built against Scala 2.12.4
[info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.CorePlugin, sbt.plugins.JUnitXmlReportPlugin, sbt.plugins.Giter8TemplatePlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.12.4
And my Scala version is not 2.12.4; it's 2.11.8. Why is it showing wrong versions?
hadoop@localhost:~$ scala -version
Scala code runner version 2.11.8 -- Copyright 2002-2016, LAMP/EPFL
Did I made any mistake?
Upvotes: 1
Views: 1904
Reputation: 8299
SBT - whichever version you have installed - will download a project-specific version of SBT when it runs. If no such version is specified, it will use the installed version. If you want a particular project to use SBT 0.13.6, then you create a file called ./project/build.properties
(relative to your project's root directory, which will be /home/hadoop/project/build.properties
in this particular case) with the following content:
sbt.version=0.13.6
SBT will then download that version and will use it to build your project.
Consequently, I strongly recommend that you always install the latest version of SBT on your machine, since that will simplify matters going forward.
BTW, I notice that you used dpkg
to install a specific SBT version, but you then used apt-get install sbt
- which will likely install the latest SBT release (I'm guessing release 1.0.3) for your version of Ubuntu, replacing the version you installed via dpkg
. What was the output from those commands? Alternatively, your /home/hadoop/project/build.properties
file - if present -
may be specifying SBT version 1.0.3.
One other thing to consider: the sbt
command should be executed from a project directory - a directory that contains just your project's sources. It's not a good idea to run sbt
from your HOME
folder, as it will leave some output folders behind (such as ./project
, ./target
, etc.)
When compiling Scala sources, SBT will use the version specified in your SBT build file (or the version used to build the SBT version being used if that property is undefined) - it does not use any installed versions of Scala that you may have on your machine.
If you want to use Scala 2.11.8, then add the following line to your SBT build file:
scalaVersion := "2.11.8"
I strongly recommend that you review the SBT documentation on its web-site.
Upvotes: 13