Gradle - settings file

About

The Gradle settings script is a configuration element of a multi-project.

It declares the configuration required to instantiate and configure the hierarchy of Project instances which are to participate in a build.

Gradle will read this file first, then the build files (one build file = one project)

There is a one-to-one correspondence between a Settings instance and a settings.gradle settings file.

Example of content

  • Name of the current build file (default to build.gradle)
  • Name of the sub-project in a multi-project

If you execute Gradle from within a project with no settings.gradle file, Gradle looks for a settings.gradle file in the following way:

  • It looks in a directory called master which has the same nesting level as the current dir.
  • If not found yet, it searches parent directories.
  • If not found yet, the build is executed as a single project build.
  • If a settings.gradle file is found, Gradle checks if the current project is part of the multi-project hierarchy defined in the found settings.gradle file.
    • If not, the build is executed as a single project build.
    • Otherwise a multi-project build is executed.

Management

Set

  • Specify the settings file
gradle [-c|--settings-file]

Documentation


Powered by ComboStrap