Add a discussion of the blank lines in .sbt files; realized everyone keeps mentioning this but "getting started" barely did

havocp 2011-11-28 12:37:56 -08:00
parent 00504bb3f1
commit 3ae924f4e9
1 changed files with 16 additions and 0 deletions

@ -111,6 +111,22 @@ If you use the wrong value type, the build definition will not compile:
```scala
name := 42 // will not compile
```
### Settings are separated by blank lines
You can't write a `build.sbt` like this:
```scala
// will NOT work, no blank lines
name := "hello"
version := "1.0"
scalaVersion := "2.9.1"
```
sbt needs some kind of delimiter to tell where one expression stops and the next begins.
`.sbt` files contain a list of Scala expressions, not a single Scala program. These expressions have to be split up and passed to the compiler individually.
If you want a single Scala program, use [[.scala files|Getting Started Full Def]] rather than `.sbt` files; `.sbt` files are optional. [[Later on|Getting Started Full Def]] this guide explains how to use `.scala` files. (Preview: the same settings expressions found in a `.sbt` file can always be listed in a `Seq[Setting]` in a `.scala` file instead.)
## Keys are defined in the Keys object