user510159
user510159

Reputation: 1379

SBT - What is the difference between name and id?

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!

Upvotes: 20

Views: 2246

Answers (2)

Faruk Sahin
Faruk Sahin

Reputation: 8756

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)

Upvotes: 10

drexin
drexin

Reputation: 24403

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.

Upvotes: 3

Related Questions