Why does the -b option not work with multiprojects builds?

(Pierre-Yves Saumont) #1

With a single module project, the build file can have any name. One just have to use the -b option to run the build. With a multimodule project, if the build name is different from “build.gradle”, we get the following error :

* Where:
Build file '.../project-parent/build2.gradle' line: 39
  * What went wrong:
A problem occurred evaluating root project 'project-parent'.
> Project with path ':project-model' could not be found in root project 'project-parent'.

Changing the name from build2.gradle to build.gradle make the problem disapear. Is there any reason for this ?

Odd behavior with command line parameters
(Peter Niederwieser) #2

In a multi-project build, everything (like which projects the build is composed of and where their build files are located) is determined based on ‘settings.gradle’. It’s not quite clear what ‘-b’ would mean in this context. I guess this is why it isn’t supported.

An alternative ‘settings.gradle’ can be passed with ‘-c’. ‘settings.gradle’ also makes sense for single-project builds, mainly because it allows to nail down the project name. Without a ‘settings.gradle’, the project name is derived from the directory name, which can be different across machines (e.g. developer vs. CI).