A gradle build has three files
build.gradle
that defines the build configuration scriptsgradle.properties
settings.gradle
Questions
settings.gradle
& gradle.properties
?settings.gradle
vs.
gradle.properties
?settings.gradle
The settings.gradle
file is a Groovy script, just like the build.gradle
file. Only one settings.gradle
script will be executed in each build (in comparison to multiple build.gradle
scripts in multi-project builds). The settings.gradle
script will be executed before any build.gradle
script and even before the Project
instances are created. Therefore, it is evaluated against a Settings
object. With this Settings
object you can add subprojects to your build, modify the parameters from the command line (StartParameter
), and access the Gradle
object to register lifecycle handlers. As a consequence, use settings.gradle
if your settings are build-related and not necessarily project-related or require logic before possible subprojects are included.
gradle.properties
The gradle.properties
file is a simple Java Properties
file that only gains a special role by being automatically included into the scope of the Project
object (as so-called 'project properties'). It's a simple key-value store that only allows string values (so you need to split lists or arrays by yourself). You can put gradle.properties
files to these locations:
.gradle
directory (for user- or environment-related values)