I want to publish a build script for my coworkers. The build script lives in a read-only directory away from the project. In order for many things (e.g. Java plugin source sets) to work correctly, the project directory needs to be a directory other than the one that contains the build script.
Gradle has a command line option --project-dir to configure this, but it seems to have no effect when paired with --build-file. Example below.
// subdirectory/build.gradle println project.rootDir println project.projectDir
$ gradle --build-file subdirectory/build.gradle $PWD/subdirectory $PWD/subdirectory $ gradle --build-file subdirectory/build.gradle --project-dir $PWD $PWD/subdirectory $PWD/subdirectory
I’ve tried playing with the current directory and with settings.gradle, but to no avail. I’m hoping I just don’t know how to do it right, and that there is no bug here.
I am running Gradle 3.4.