You can specify any path you like from the command-line, like
--include-build ../some/path. That’s fine for one off/temporary situations.
You can specify a path that you look at, by convention, e.g., you’ll include all builds that are checked out into
$HOME/checkedOutProjects. This could potentially be something that’s configurable per-person.
Lastly, you could also externalize the list of included builds into a file that you check for, e.g.
$HOME/my-included-builds.txt could contain the fully qualified paths to all included builds. In that case, you could read the file in
settings.gradle and call
includedBuild for each.
As an aside, I think your example might be referring to the
build.gradle? Either way, you should avoid the use of
new File(...) because it will always be relative to the current working directory of the daemon which may not be your project directory. You should use
file() if you need a File-like thing instead.
includeBuild already does this in
settings.gradle, so you can just pass the file path (
You also don’t want to litter your
build.gradle with checks for included builds. If you want to have a
build task that depends on all of the other included builds
build tasks, you can just do
build.dependsOn gradle.includedBuilds*.task(":build"). If there aren’t any included builds, you won’t depend on anything (this returns an empty list).