Hi Rene, I did not know about the gradle.properties files. This indeed is just what I was looking for. In looking at how it is implemented however, I am confused by the override behavior.
I'm used to values passed in at the command line to override any other settings. I'm told this is what you'd expect from ant as well. This seems to hold true for -P, but -D is ignored if the value is defined in gradle.properties. With this in your build.gradle file: println "${fruit} is ${System.getProperty('color')} 1) Execute gradle with command line overrides to get: >gradle -Pfruit=banana -Dcolor=yellow banana is yellow Next add the following to gradle.properties in same folder as build.gradle: fruit=apple systemProp.color=red 2) Execute gradle with command line overrides to get: >gradle -Pfruit=banana -Dcolor=yellow banana is red Next add the following to gradle.properties in ~/.gradle: fruit=orange systemProp.color=orange 3) Execute gradle with command line overrides to get: >gradle -Pfruit=banana -Dcolor=yellow banana is orange I'm using milestone-3. Is this the expected behavior? Thanks, Richard. From: Rene Groeschke [mailto:gra...@breskeby.com] Sent: Monday, October 17, 2011 1:05 PM To: user@gradle.codehaus.org Subject: Re: [gradle-user] init script to parameterize build? Hi Richard, for user specific properties, you can use the gradle.properties file in your user related gradle directory. On my mac this would be ~/.gradle/gradle.properties. All properties defined in this file overwrite according values defined in a project specific gradle.properties file. IMHO this is the most convenient way to provide user specific properties for your build scripts. regards, René Am 17.10.11 21:54, schrieb Richard Miehe: I have been passing in several settings using on my gradle command line using -D. Many of the settings are always the same for a particular machine or user. It seems like init.gradle is the perfect spot to put this type of thing. I have not found any way of defining variables in an init script, then accessing them from a build.gradle script. Am I missing something obvious? Any examples would be appreciated. ________________________________ Disclaimer: This e-mail (and any attachments to it) is confidential and intended solely for the named person/s to whom it is addressed. If you are not an intended recipient, please notify us immediately and delete the email from your system. Any review, dissemination or other use of it in these circumstances is prohibited.