嗨,我刚刚在这里安装了sbt表单https://www.scala-sbt.org/download.html
(windows sbt-1.0.4.msi),然后我做了sbt about
它产生了
C:\Users\rajnish.kumar>sbt about
"C:\Users\rajnish.kumar\.sbt\preloaded\org.scala-sbt\sbt\"1.0.4"\jars\sbt.jar"
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[warn] Executing in batch mode.
[warn] For better performance, hit [ENTER] to switch to interactive mode, or
[warn] consider launching sbt without any commands, or explicitly passing 'shell'
[info] Loading project definition from C:\Users\rajnish.kumar\project
[info] Set current project to rajnish-kumar (in build file:/C:/Users/rajnish.kumar/)
[info] This is sbt 0.13.15
[info] The current project is {file:/C:/Users/rajnish.kumar/}rajnish-kumar 0.1-SNAPSHOT
[info] The current project is built against Scala 2.10.6
[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.10.6
问题是它为什么打印sbt版本0.13.15而不是1.0.4?我正在使用Windows 8。
您在Windows 10上尝试了相同的操作并获得了预期的结果
C:\Users\rajnish>sbt about
"C:\Users\rajnish\.sbt\preloaded\org.scala-sbt\sbt\"1.0.4"\jars\sbt.jar"
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading project definition from C:\Users\rajnish\project
[info] Set current project to rajnish (in build file:/C:/Users/rajnish/)
[info] This is sbt 1.0.4
[info] The current project is {file:/C:/Users/rajnish/}rajnish 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
答案 0 :(得分:1)
为了在构建项目时真正实施SBT版本,您应该在project/build.properties
文件中指定此版本。以下是我的项目中此文件的内容:
sbt.version = 1.0.4
如果我导航到根项目文件夹并运行sbt about
,它会显示我
[info] This is sbt 1.0.4
[info] The current project is {file:/ssd2/projects/ADMP/}admp 1.0
[info] The current project is built against Scala 2.11.9
如果我将build.properties
中的版本更改为
sbt.version = 1.0.1
然后运行sbt about
它显示我
[info] This is sbt 1.0.1
[info] The current project is {file:/ssd2/projects/ADMP/}admp 1.0
[info] The current project is built against Scala 2.11.9
SBT知道加载特定版本源,如果当前版本的SBT不同,则加载它们,编译该版本的SBT,然后使用该版本的SBT构建您的项目。
为什么默认情况下会显示0.13.15 - 我不确定。可能在您的项目中,您在build.properties
中指定了该版本,可能是出于其他原因。
请尝试使用sbtVersion
任务进行检查。运行命令sbt sbtVersion
。
答案 1 :(得分:0)
对我而言,原来安装不是那么干净。我已经做了解决这个问题的步骤:
1.从程序文件中手动删除sbt安装目录
2.删除目录c:\ Users \ .sbt
3.使用add remove program卸载sbt。
4.安装sbt新版本。
5.交叉检查环境变量,例如SBT_HOME和路径
6.运行sbt sbtVersion以验证新安装的版本。