SBT目录结构。什么是 "project"?

SBT directory structure. What's "project"?

一个播放项目有一个 "project" 文件夹,如下所示:

我一直认为这只是我不应该想太多的人生谜团之一,但今天我的好奇心战胜了我。

谷歌搜索给了我 this 其中提到顶级 "project" 文件夹用于 sbt 配置。我想知道为什么他们不把那个“.sbt”称为 la“.git”,为什么那个文件夹外还有一个文件 "build.sbt",但我想实际上做东西没有乐趣说得通。

它也没有提到为什么它包含另一个 "project" 文件夹。

为什么会有嵌套的 "project" 文件夹?

http://www.scala-sbt.org/0.13/tutorial/Organizing-Build.html:

build.sbt conceals how sbt really works. sbt builds are defined with Scala code. That code, itself, has to be built. What better way than with sbt?

The project directory is another build inside your build, which knows how to build your build. To distinguish the builds, we sometimes use the term proper build to refer to your build, and meta-build to refer to the build in project. The projects inside the metabuild can do anything any other project can do. Your build definition is an sbt project.

And the turtles go all the way down. If you like, you can tweak the build definition of the build definition project, by creating a project/project/ directory.

SBT 是递归的。它使用 scala 代码为您的项目定义构建属性。在哪里放置scala代码?到当前项目中的另一个项目。但是如果项目定义本身是一个合适的项目,那么它可以用另一个 sbt 配置来配置。等等。 Scala 的人喜欢递归结构。

您可以更改嵌套(在元意义上)项目的 Scala 编译器版本和 Scala 编译器选项。它可能会改变元项目的解释方式,并且会影响最上面的项目。