Using alternate build file fails


(Carlo Luib-Finetti) #1

For testing purposes I copied my root build file (build.gradle), brought in the Nebua Lint plugin and tried run it. The build fails, because it says it cannot find the subproject I gave on the command line. If I use the original build.gradle, it works fine.

gradle --build-file=build.gradle --info de.webdms.common.server:cJ

versus

gradle --build-file=lintbuild.gradle --info de.webdms.common.server:cJ

Gradle says:

  • What went wrong:
    Project ‘de.webdms.common.server’ not found in root project ‘uvdms-gwt’.

I cannot figure out what is wrong with this.


(James Justinic) #2

That option isn’t compatible with a multi-project build. The --build-file option also implies that you want to treat the build as a single project build, ignoring settings.gradle.

If you want to use a different build file for the multi-project build, you need to use settings.gradle to do it. Create a copy such as lintsettings.gradle that configures the custom build file name:

rootProject.buildFileName = 'lintbuild.gradle'

Now, run your build with the --settings-file option instead of the --build-file option:

gradle --settings-file=lintsettings.gradle --info de.webdms.common.server:cJ

(Carlo Luib-Finetti) #3

Thank you James - I didn’t know this.
As far as I know, this is not documented in the manual?