In sbt’s terminology, the “base directory” is the directory containing
the project. So if you created a project
/tmp/foo-build/build.sbt as in the sbt by example,
/tmp/foo-build is your base directory.
sbt uses the same directory structure as Maven for source files by default (all paths are relative to the base directory):
src/ main/ resources/ <files to include in main jar here> scala/ <main Scala sources> java/ <main Java sources> test/ resources <files to include in test jar here> scala/ <test Scala sources> java/ <test Java sources>
Other directories in
src/ will be ignored. Additionally, all hidden
directories will be ignored.
Source code can be placed in the project’s base directory as
hello/app.scala, which may be for small projects,
though for normal projects people tend to keep the projects in
src/main/ directory to keep things neat.
The fact that you can place
*.scala source code in the base directory might seem like
an odd trick, but this fact becomes relevant later.
The build definition is described in
build.sbt (actually any files named
*.sbt) in the project’s base directory.
In addition to
project directory can contain
that defines helper objects and one-off plugins.
See organizing the build for more.
build.sbt project/ Dependencies.scala
You may see
.sbt files inside
project/ but they are not equivalent to
.sbt files in the project’s base directory. Explaining this will
come later, since you’ll need some background information first.
Generated files (compiled classes, packaged jars, managed files, caches,
and documentation) will be written to the
target directory by default.
.gitignore (or equivalent for other version control systems) should
Note that this deliberately has a trailing
/ (to match only directories)
and it deliberately has no leading
/ (to match
addition to plain