folks,
is anyone aware how to use gradle to run with a custom build.gradle
AND settings.gradle
- i.e both together?
I think that I can have a custom build.gradle file (-b
flag) - but then this ignores the custom settings flag -c
flag.
I think (although I can't immediatley point to thepart in the documentation) that if you specificy a custom build.gradle, then it ignores your settings.gradle override -c
option.
If this isn't possible - is it possible to inform gradle of a multiproject build using only a build.gradle file and ignoring any settings.gradle
motivation is to create a 'lite' version of a fairly large and complex build that only runs certain elements.
The general philosophy of Gradle is to express all different usages in a single build model. That said, here are a few thoughts:
-b
forces a single-project build using the given build script. I'd say that this feature is mainly intended for demonstration purposes, and I haven't used it for production builds.
In a multi-project build, the location of build scripts is solely determined by the settings script. By default, Gradle will look for a settings script named settings.gradle
. However, you could have multiple settings scripts and choose among them with the -c
option, or have multiple settings.gradle
in different directories and choose among them by starting the build from the appropriate directory. As a last resort, you could write a settings script that conditionally includes different projects, or points to different build scripts, depending on some condition. Note that even single-project builds can have a settings script.
To explore the API available to settings scripts, look up the Settings
type in the Gradle Build Language Reference.