I need some way to inject some machine specific properties into my project. Unfortunately neither of both variants init script or gradle properties work in my case.
I’ve placed them - like stated in the docu - into:
when manually reading the file from user.home/.gradle/gradle.properties the content is properly printed out:
D:\projects\gradledemo>gradle echo
==propertiesFile
testPropertyName: testPropertyValue
==hasProperty
false
==project.property
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\projects\gradledemo\build.gradle' line: 11
* What went wrong:
A problem occurred evaluating root project 'gradledemo'.
> Could not find property 'testPropertyName' on root project 'gradledemo'.
* 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: 5.927 secs
There is one thing I do not understand. When I define some property on the command line ("-P=xxx"), then this property is undefined in a user defined task, but is available in an applied script.
The question is where is the file located? If I put it into the projectDir it works nicely. But if I put it into the $USER_HOME resp. ${user.home} than it has no effect.
But exactly this is what I need. As workaround I’ve checked in username and password into the build script but actually this is not what I want.