scala 是 2.10.1 但 sbt 控制台不是? [英] scala is 2.10.1 but sbt console is not?
问题描述
我是 Scala/SBT 的新手,所以请保持温和,但我正在尝试通过 SBT入门",我注意到我的 brew 安装的 scala 和 sbt 工具之间存在差异.当我直接启动 Scala 的 REPL 时,它报告自己为 Scala 2.10.1,这正是我所期望的.
I'm new to Scala/SBT, so please be gentle, but I'm trying to work my way through the SBT "Getting Started" and I noticed a discrepancy between my brew installed scala and sbt tools. When I launch the REPL for scala directly, it reports itself as Scala 2.10.1, which is what I would expect.
bobk-mbp:work bobk$ scala
Welcome to Scala version 2.10.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_17).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :quit
当我通过 SBT 启动 REPL 时,REPL 断言它是 2.9.2?!?
When I launch the REPL through SBT, the REPL asserts it is 2.9.2?!?
bobk-mbp:work bobk$ sbt console
[info] Set current project to default-690573 (in build file:/Users/bobk/work/)
[info] Starting scala interpreter...
[info]
Welcome to Scala version 2.9.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_17).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :quit
这是怎么回事?我期待构建工具使用我的开发箱上托管的 scala 环境.它从哪里获得 2.9.2 以及如何让它使用 2.10.1?
What's up with that? I was expecting the build tool to use the scala environment that is hosted on my dev box. Where is it getting 2.9.2 and how do I get it to use the 2.10.1?
scala 和 sbt 都是通过 brew 安装的,但我认为这并不重要.sbt 版本好像是 0.12.3
Both scala and sbt were installed via brew, but I don't think that really matters. The sbt version appears to be 0.12.3
bobk-mbp:work bobk$ sbt --version
sbt launcher version 0.12.3
推荐答案
如果不带参数启动 sbt:
If you start sbt with no parameters:
sbt
> ++ 2.10.1
> console
应该为该会话提供 Scala 2.10.1.我不知道如何在不重建 sbt 本身的情况下使其成为所有 sbt 会话的默认值.
should give you Scala 2.10.1 for that session. I don't know how to make it the default for all sbt sessions without rebuilding sbt itself.
这篇关于scala 是 2.10.1 但 sbt 控制台不是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!