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





Discover More
Gradle - Configuration (Phase and element)

The configuration phase is the second fixed phase of a build execution It constructs and configures the task graph for the build and then determines which tasks need to run and in which order, based on...
Idea Create Gradle Project
Gradle - Getting Started

How to get a minimal project to start with gradle installation Create a project with gradle init (preferred) or with idea This method is the preferred one...
Gradle - Lifecycle

clean, check, assemble and build tasks the standard lifecycle tasks don’t have any actions. They simply aggregate multiple tasks together. Create a settings object instance for the build. Evaluate...
Gradle - Multi-Project

A page multi-project setup in gradle. There is only one settings.gradle file at the root There is one top-level build script (build.gradle) (also known as the root project) that configure common...
Gradle - Project

A gradle project A gradle project has two files at the root directory of a project. - task a - configuration For a multi-project, each sub-project is a sub-directory with a build.gradle file....
Gradle - Script

Gradle scripts are configuration scripts. As the script executes, it configures/build an object of a particular type (called the delegate object of the script) Type of script Build and instance...
Gradle - Single Project

A single-project has only the root project listed in the output of the gradle projects command, it's a multi-project ...



Share this page:
Follow us:
Task Runner