20

I was wondering if there is a difference in SBT between a project's name and id.

I noticed example build.sbt files with the following key:

name := "My Project"

And I noticed Build.scala files with:

Project(id = "My Project", base = file("."))

Is there a difference? Should the two be the same or is it irrelevant? What are they used for?

Thanks!

user510159
  • 1,379
  • 14
  • 26

2 Answers2

10

Project name should be used for the name of your project, the visible title for any documentation.

Id is used to refer to the project to modify settings or in terms of dependancy management, i.e to connect a subproject to a root project you can say subproject.dependsOn(rootProjectId)

Faruk Sahin
  • 8,406
  • 5
  • 28
  • 34
3

In your build.sbt file you have a single project definition. You can also pass a name attribute to the settings of a Project in your build.scala. As you can have several sub projects in a build file, you have to provide an id for each of them, while the project name remains the same.

drexin
  • 24,225
  • 4
  • 67
  • 81