At the moment this is kind of funky, but I find that the best way to determine the version of SBT is to move to a temporary directory and then run the
sbt sbtVersion command:
$ cd ~/tmp > sbt sbtVersion [warn] No sbt.version set in project/build.properties, base directory: /Users/al/tmp [info] Loading settings for project global-plugins from idea.sbt ... [info] Loading global plugins from /Users/al/.sbt/1.0/plugins [info] Set current project to tmp (in build file:/Users/al/tmp/) [info] 1.2.6
The reason I move to a temporary directory is that at least with version 1.2.6 of SBT, this command has some funky results:
- If you’re in the root directory of an existing SBT project, this command:
- May overwrite your project/build.properties value
- May report the project/build.properties value
Therefore, if you want to know what binary version of SBT you have installed, i.e., what version is run when you type
sbt at the command line, I find it best to move to an empty directory.
Note: I suspect that the problems I outline above are bugs, and I reported them as this SBT bug.
If you need to see the SBT version of the current project
Assuming those bugs go away, you should be able to tell what version of Scala you’re using in your SBT project with this command:
$ sbt sbtVersion
Here’s the output from this command on a current project from inside the SBT shell:
sbt> sbtVersion [info] 1.2.6
On a well-configured project you can also look at the
sbt.version that’s set in the project/build.properties file:
If you needed to see what SBT version you were using in your Scala/SBT project, I hope that’s helpful.