From 3ae924f4e9e9997bdf07563434f4fb95a21cead0 Mon Sep 17 00:00:00 2001 From: havocp Date: Mon, 28 Nov 2011 12:37:56 -0800 Subject: [PATCH] Add a discussion of the blank lines in .sbt files; realized everyone keeps mentioning this but "getting started" barely did --- Getting-Started/Getting-Started-Basic-Def.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Getting-Started/Getting-Started-Basic-Def.md b/Getting-Started/Getting-Started-Basic-Def.md index 00f26fe..adb9478 100644 --- a/Getting-Started/Getting-Started-Basic-Def.md +++ b/Getting-Started/Getting-Started-Basic-Def.md @@ -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