如何检查版本?
我如何检查我正在运行的版本?
我有设置使用sbt-launch.jar
的bash文件,它的工作原理,但
$ sbt version
只显示“工程版本”(0.1)和
$ sbt --version
什么也没做。
$ sbt sbtVersion
这会打印当前项目中使用的sbt版本,或者是每个模块的多模块项目。
$ sbt 'inspect sbtVersion' [info] Set current project to jacek (in build file:/Users/jacek/) [info] Setting: java.lang.String = 0.13.1 [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:68 [info] Delegates: [info] *:sbtVersion [info] {.}/*:sbtVersion [info] */*:sbtVersion [info] Related: [info] */*:sbtVersion
你可能也想使用sbt about
(复制Mark Harrah的评论 ):
最近添加的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
- 如果你正在使用Windows使用windowsKey + R键入cmd,然后按enter或导航到.sbt文件夹(例如:C:\ Users \ Prasad),并在地址栏中inputcmd,然后input。
- 键入sbt然后input以获取SBT版本
在SBT 0.13及更高版本中,可以使用sbtVersion
任务(如sbtVersion
指出的那样)或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项目中使用时,任务/设置可能会显示不同的输出。
你可以使用sbt about
例: C:\ Users \ smala> sbt左右 [info]将当前项目设置为smala(在构build文件中:/ C:/ Users / smala /) 这是0.13.6 [info]当前的项目是{file:/ C:/ Users / smala /} smala 0.1-SNAPSHOT 目前的项目是针对Scala 2.10.4构build的 [info]可用插件:sbt.plugins.IvyPlugin,sbt.plugins.JvmPlugin,sbt.plugins.CorePlugin,sbt.plugins.JUnitXmlReportPlugin [info] sbt,sbt插件和构build定义使用Scala 2.10.4“