From the User Guide 11.5: When you run the gradle command, it looks for a build file in the current directory. You can use the -b option to select another build file. If you use -b option then settings.gradle file is not used.
But I have to have a settings.gradle to set a multiproject project. I tried to set it using “-c” and it was still ignored. It seems to be in the code here in org.gradle.initialization.SettingsHandler
public SettingsInternal findAndLoadSettings(GradleInternal gradle) {
StartParameter startParameter = gradle.getStartParameter();
SettingsInternal settings = findSettingsAndLoadIfAppropriate(gradle, startParameter);
ProjectSpec spec = ProjectSpecs.forStartParameter(startParameter);
if (!spec.containsProject(settings.getProjectRegistry())) {
// The settings we found did not include the desired default project
if (startParameter.getProjectDir() == null && spec.isCorresponding(settings.getSettingsDir())) {
// The desired default project is the settings directory
// So execute the root project instead.
settings.setDefaultProject(settings.getRootProject());
} else {
// Try again with an empty settings file.
StartParameter noSearchParameter = startParameter.newInstance();
noSearchParameter.useEmptySettings();
settings = findSettingsAndLoadIfAppropriate(gradle, noSearchParameter);
if (settings == null) { // not using an assert to make sure it is not disabled
throw new InternalError("Empty settings file does not contain expected project.");
}
// Set explicit build file, if required
if (noSearchParameter.getBuildFile() != null) {
ProjectDescriptor rootProject = settings.getRootProject();
rootProject.setBuildFileName(noSearchParameter.getBuildFile().getName());
}
setDefaultProject(spec, settings);
}
} else {
setDefaultProject(spec, settings);
}
return settings;
}
What do I do?