% mkdir myproj
% cd myproj
% echo 'object MyProject extends App { println("hello world") }' > MyProject.scala
% sbt
[info] Loading global plugins from /Users/tisue/.sbt/0.13/plugins
[info] Set current project to myproj (in build file:/Users/tisue/myproj/)
> set scalaVersion := "2.11.7"
[info] Defining *:scalaVersion
[info] The new value will be used by *:Additional arguments for the presentation compiler., *:allDependencies and 13 others.
[info] Run `last` for details.
[info] Reapplying settings...
[info] Set current project to myproj (in build file:/Users/tisue/myproj/)
> session save
[info] Reapplying settings...
[info] Set current project to myproj (in build file:/Users/tisue/myproj/)
> run
[info] Updating {file:/Users/tisue/myproj/}myproj...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/tisue/myproj/target/scala-2.11/classes...
[info] Running MyProject
hello world
[success] Total time: 2 s, completed Nov 18, 2015 9:46:26 PM
>
src/main/scala
必要に応じて、ソースをプロジェクト ディレクトリのルート レベルではなく、その下に置くことができます。これも機能します。
session save
build.sbt
次のようなファイルを作成します。
scalaVersion := "2.11.7"
set
必要に応じて、とを使用するかsession save
、ファイルを直接編集して、後で設定を追加できます。
明示的に設定しないscalaVersion
と、残念ながら 2.11 ではなく Scala 2.10 になってしまいます :-(