user_home init.gradle/

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:

$USER_HOME/.gradle/init.gradle or


I use gradle-1.11 and windows 7.

please tell how you’re trying to get their values? What happens?

ok the I’ve put it into a separate build.gradle:

def userHome =['user.home']
def propertiesFile = new File(userHome, '.gradle/')
  println "==propertiesFile"
  println "==hasProperty"
println project.hasProperty('testPropertyName')
  println ""
println project.testPropertyName

when manually reading the file from user.home/.gradle/ the content is properly printed out:

D:\projects\gradledemo>gradle echo
testPropertyName: testPropertyValue
  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.
  Total time: 5.927 secs

if I have defined in “” these:


Then in"" (or some other Gradle script) these are accessible like here:

println "Artifactory user: " + artifactoryUser
println "Build Host: " + buildHost
println "carlos.text: " +['carlos.text']

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.