我如何检查哪个版本的SBT我正在运行?
我已经设置了Bash文件,使用sbt-launch.jar,它可以工作,但是
sbt version
只显示“项目版本”(0.1)和
sbt --version
什么也不做。
我如何检查哪个版本的SBT我正在运行?
我已经设置了Bash文件,使用sbt-launch.jar,它可以工作,但是
sbt version
只显示“项目版本”(0.1)和
sbt --version
什么也不做。
当前回答
输入“sbt about”,然后回车,得到sbt版本:
其他回答
运行命令"sbt sbt-version"将简单地输出您的当前目录和版本号。
$ sbt sbt-version
[info] Set current project to spark (in build file:/home/morgan/code/spark/)
[info] 0.13.8
sbt --version
它现在的版本为1.3.3+(归功于@ElectronWill)。
你可能还想使用sbt(复制Mark Harrah的评论):
最近添加了about命令,以尝试简洁地打印 最相关的信息,包括SBT版本。
从sbt外壳内部
sbt:venkat> about
[info] This is sbt 1.3.3
...
最新版本的SBT终于支持标准版本标志!
$ sbt --version
sbt version in this project: 1.6.2
sbt script version: 1.6.2
(用1.6+测试,但似乎至少从1.3.3开始就存在了)
在SBT 0.13及以上版本中,您可以使用sbtVersion任务(由@steffen指出)或about命令(由@mark-harrah指出)
在SBT项目内部和外部,sbtVersion任务的工作方式是不同的。在SBT项目中,sbtVersion显示项目及其子项目使用的SBT版本。
$ sbt sbtVersion
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Updating {file:/Users/jacek/.sbt/0.13/plugins/}global-plugins...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Loading project definition from /Users/jacek/oss/scalania/project
[info] Set current project to scalania (in build file:/Users/jacek/oss/scalania/)
[info] exercises/*:sbtVersion
[info] 0.13.1-RC5
[info] scalania/*:sbtVersion
[info] 0.13.1-RC5
在project/build.properties中设置:
jacek:~/oss/scalania
$ cat project/build.properties
sbt.version=0.13.1-RC5
在SBT项目外部执行的相同任务将显示可执行文件本身的当前版本。
jacek:~
$ sbt sbtVersion
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Updating {file:/Users/jacek/.sbt/0.13/plugins/}global-plugins...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to jacek (in build file:/Users/jacek/)
[info] 0.13.0
当您在外部时,about命令似乎更适合,因为它显示了sbt版本以及Scala的和可用的插件。
jacek:~
$ sbt about
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Set current project to jacek (in build file:/Users/jacek/)
[info] This is sbt 0.13.0
[info] The current project is {file:/Users/jacek/}jacek 0.1-SNAPSHOT
[info] The current project is built against Scala 2.10.2
[info] Available Plugins: com.typesafe.sbt.SbtGit, com.typesafe.sbt.SbtProguard, growl.GrowlingTests, org.sbtidea.SbtIdeaPlugin, com.timushev.sbt.updates.UpdatesPlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.10.2
你可能想运行'help about'来阅读它的文档:
jacek:~
$ sbt 'help about'
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Set current project to jacek (in build file:/Users/jacek/)
Displays basic information about sbt and the build.
对于sbtVersion设置,inspect命令可以提供帮助。
$ sbt 'inspect sbtVersion'
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Set current project to jacek (in build file:/Users/jacek/)
[info] Setting: java.lang.String = 0.13.0
[info] Description:
[info] Provides the version of sbt. This setting should be not be modified.
[info] Provided by:
[info] */*:sbtVersion
[info] Defined at:
[info] (sbt.Defaults) Defaults.scala:67
[info] Delegates:
[info] *:sbtVersion
[info] {.}/*:sbtVersion
[info] */*:sbtVersion
[info] Related:
[info] */*:sbtVersion
人们似乎希望通过检查了解SBT版本的版本设置是设置当前模块的版本/修订号。
$ sbt 'inspect version'
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Set current project to jacek (in build file:/Users/jacek/)
[info] Setting: java.lang.String = 0.1-SNAPSHOT
[info] Description:
[info] The version/revision of the current module.
[info] Provided by:
[info] */*:version
[info] Defined at:
[info] (sbt.Defaults) Defaults.scala:102
[info] Reverse dependencies:
[info] *:projectId
[info] *:isSnapshot
[info] Delegates:
[info] *:version
[info] {.}/*:version
[info] */*:version
[info] Related:
[info] */*:version
在SBT项目中使用时,任务/设置可能会显示不同的输出。