A gradle build has three files
build.gradle that defines the build configuration scriptsgradle.propertiessettings.gradle Questions
settings.gradle & gradle.properties?settings.gradle vs. gradle.properties?properties. This is optional, its main purpose is to provide startup options to use for running gradle itself, e.g. These values can be overridden by a file USER_HOME/.
The framework requires the existence of the settings. gradle in a multi-project build, while it's optional for a single-project build.
gradle file, located in each project / module / directory, allows you to configure build settings for the specific module it is located in.
Actually there are 3 places where gradle. properties can be placed: Under gradle user home directory defined by the GRADLE_USER_HOME environment variable, which if not set defaults to USER_HOME/. gradle.
settings.gradleThe 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.propertiesThe 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)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With