Settings File Basics
Settings file is the entry point of every Gradle project. The primary purpose of the settings file is to add subprojects to your build. Gradle supports single and multi-project builds.
- Settings file is optional for single-project builds.
- Settings file is mandatory and declares all subprojects for multi-project builds.
Settings script
The settings file is a script. It is either a settings.gradle
file written in Groovy
or a settings.gradle.kts
file in Kotlin.
The Groovy DSL and Kotlin DSL are the only accepted languages for Gradle scripts.
The settings file is typically found in the root directory of the project:
- Kotlin
- Groovy
settings.gradle.kts
rootProject.name = "root-project" (1)
include("sub-project-a") (2)
include("sub-project-b")
include("sub-project-c")
settings.gradle
rootProject.name = 'root-project' (1)
include('sub-project-a') (2)
include('sub-project-b')
include('sub-project-c')
(1) Define the project name.
(2) Add subprojects.