Gradle properties are stored to the file named gradle.properties
. It can be located in the project root directory or in ~/.gradle/
According to this discussion on gradle.org, the property file in the project root should contain project specific properties and should be under source control (Git in my case). User specific properties should be in ~/.gradle/gradle.properties
so that they are not committed under SCM.
But where should I put properties that are specific to a particular user on a particular project, let's say credentials to central Git repository?
I am using jgitflow-gradle-plugin
that requires properties gitUsername
and gitPassword
. These properties should not be committed definitely. Therefore, they cannot be placed in gradle.properties in project root directory. On the other hand, they should not be shared by different projects as I can use different Git central repository with different credentials.
Is there a way to use multiple gradle.properties
files in a single project? One of them would be committed and another one would be git-ignored.