Movatterモバイル変換


[0]ホーム

URL:


 > >

Directory structure 

This page assumes you’veinstalled sbt and seen theHello, World example.

Base directory 

In sbt’s terminology, the “base directory” is the directory containingthe project. So if you created a projecthello containinghello/build.sbt as in theHello, Worldexample,hello is your base directory.

Source code 

sbt uses the same directory structure asMaven for source files by default (all pathsare 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 insrc/ will be ignored. Additionally, all hiddendirectories will be ignored.

Source code can be placed in the project’s base directory ashello/app.scala, which may be for small projects,though for normal projects people tend to keep the projects inthesrc/main/ directory to keep things neat.The fact that you can place*.scala source code in the base directory might seem likean odd trick, but this fact becomes relevantlater.

sbt build definition files 

The build definition is described inbuild.sbt (actually any files named*.sbt) in the project’s base directory.

build.sbt

Build support files 

In addition tobuild.sbt,project directory can contain.scala filesthat defines helper objects and one-off plugins.Seeorganizing the build for more.

build.sbtproject/  Dependencies.scala

You may see.sbt files insideproject/ but they are not equivalent to.sbt files in the project’s base directory. Explaining this willcomelater, since you’ll need some background information first.

Build products 

Generated files (compiled classes, packaged jars, managed files, caches,and documentation) will be written to thetarget directory by default.

Configuring version control 

Your.gitignore (or equivalent for other version control systems) shouldcontain:

target/

Note that this deliberately has a trailing/ (to match only directories)and it deliberately has no leading/ (to matchproject/target/ inaddition to plaintarget/).

Next Page> Running

Contents

sbt Reference Manual
    1. Directory structure
        sbt
        DocumentationDownloadGet InvolvedSource codesbt on Twitter

        Community Support

        StackOverflow
        lightbend-icon

        [8]ページ先頭

        ©2009-2025 Movatter.jp