I have a multi-module build, and occasionally need to access properties defined on one project from another (in inter-project dependencies). It seems that if the project containing the property is lexically sorted earlier, the property resolution works, but if it is later, it fails. I have linked a simple project which shows the problem.
when run:
$ gradle -Ptryc access
:childc:accessPropFromC
yay
BUILD SUCCESSFUL
Total time: 2.531 secs
$ gradle -Ptrya access
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/bcarr/scm/multiprojectprops/childa/build.gradle' line: 3
* What went wrong:
A problem occurred evaluating project ':childa'.
Cause: Could not find property 'exampleProperty' on project ':childb'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.131 secs