How does Gradle search for the "settings.gradle" file?

In the GUG, section 55.4, “Initialization”, there is the following about multi-project builds:

“If you execute Gradle from within a project that has no settings.gradle file, Gradle does the following: It searches for a settings.gradle in a directory called master which has the same nesting level as the current dir. If no settings.gradle is found, it searches the parent directories for the existence of a settings.gradle file.”

This seems to be saying that anytime I execute Gradle in a directory that does not have a “settings.gradle” file, Gradle will search up the entire file tree looking for a “settings.gradle” file. Is this really what it does?

Looking at https://github.com/gradle/gradle/blob/master/subprojects/core/src/main/groovy/org/gradle/initialization/layout/BuildLayoutFactory.java I’d say it is.

Yes that is what it does - you can turn this behaviour off with the -u command line switch

http://www.gradle.org/docs/current/userguide/gradle_command_line.html