Jak sprawdzić wersję sbt?

Jak sprawdzić, którą wersję sbt używam?

Mam ustawiony plik Basha, który używa sbt-launch.jar i działa, ale

$ sbt version

Pokazuje tylko" wersję projektu " (0.1) i

$ sbt --version
Nic nie robi.
 261
sbt
Author: Jacek Laskowski, 2011-12-11

7 answers

$ sbt sbtVersion

Wyświetla wersję sbt używaną w bieżącym projekcie lub jeśli jest to projekt wielomodułowy dla każdego modułu.

$ 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

Możesz również użyć sbt about that (kopiowanie komentarz Marka Harraha):

Polecenie about zostało dodane niedawno, aby spróbować zwięźle wydrukować najistotniejsze informacje, w tym wersja sbt.

 365
Author: Steffen,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-05-23 11:54:59

Uruchamiając polecenie, "SBT SBT-version" wyświetli po prostu bieżący katalog i numer wersji.

$ sbt sbt-version
[info] Set current project to spark (in build file:/home/morgan/code/spark/)
[info] 0.13.8
 26
Author: Morgan Kenyon,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-06-27 00:08:23
  1. Jeśli używasz systemu windows użyj windowsKey+R wpisz cmd, a następnie naciśnij enter lub przejdź do .folder sbt (np. C: \ Users\Prasad) i wpisz cmd na pasku adresu, a następnie wprowadź.
  2. Wpisz SBT o następnie wprowadź, aby uzyskać wersję SBT

Tutaj wpisz opis obrazka

 18
Author: Prasad,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-02-11 04:52:45

W SBT 0.13 i nowszych, możesz użyć sbtVersion task (jak wskazał @steffen) lub about command (jak wskazał @mark-harrah)

Jest różnica, jak zadanie sbtVersion działa w projekcie SBT i poza nim. Gdy w projekcie SBT, sbtVersion wyświetla wersję SBT używaną przez projekt i jego podprojekty.

$ 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

Jest ustawione w project/build.properties:

jacek:~/oss/scalania
$ cat project/build.properties
sbt.version=0.13.1-RC5

To samo zadanie wykonane poza projektem SBT pokazuje aktualną wersję pliku wykonywalnego siebie.

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

Kiedy jesteś na zewnątrz, komenda about wydaje się być lepiej dopasowana, ponieważ pokazuje wersję sbt, a także dostępne wtyczki Scali.

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

Możesz uruchomić 'help about', aby przeczytać jego dokumentację:

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.

Dla Ustawienia sbtVersion, polecenie inspect może pomóc.

$ 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

Ustawienie version, które ludzie spodziewają się sprawdzić, aby wiedzieć, że wersja SBT jest ustawiona wersja / rewizja bieżącego moduł .

$ 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

W przypadku użycia w projekcie SBT zadania / ustawienia mogą wyświetlać różne wyniki.

 9
Author: Jacek Laskowski,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-01-22 20:15:09

Możesz użyć sbt about

Example: 
    C:\Users\smala>sbt about
    [info] Set current project to smala (in build file:/C:/Users/smala/)
    [info] This is sbt 0.13.6
    [info] The current project is {file:/C:/Users/smala/}smala 0.1-SNAPSHOT
    [info] The current project is built against Scala 2.10.4
    [info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin,   sbt.plugins.CorePlugin, sbt.plugins.JUnitXmlReportPlugin
    [info] sbt, sbt plugins, and build definitions are using Scala 2.10.4"
 5
Author: Sandeep M,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-10-10 05:27:42

Uruchom konsolę SBT, a następnie wpisz sbtVersion, aby sprawdzić wersję SBT, i scalaVersion dla wersji Scali

 0
Author: Abdelwahed Houbouby,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-12-05 15:11:55

Robienie sbt sbt-version doprowadziło do pewnego błędu jako

[error] Not a valid command: sbt-version (similar: writeSbtVersion, session)
[error] Not a valid project ID: sbt-version
[error] Expected ':'
[error] Not a valid key: sbt-version (similar: sbtVersion, version, sbtBinaryVersion)
[error] sbt-version
[error]            ^

Jak widać podpowiedź similar: sbtVersion, version, sbtBinaryVersion, wszystkie działają, ale poprawna jest generowana przez sbt sbtVersion

 0
Author: Ramesh Maharjan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-08-22 07:07:00