How do I provide credentials for Gradle Wrapper without embedding them in my project's gradle-wrapper.properties file?


(Salim Fadhley) #1

In order to bootstrap Gradle-Wrapper, I need to pull the Gradle distribution from an Artifactory which requires HTTP Basic-Auth.

The Gradle documentation suggests putting the username & password into gradle-werapper.properties.

If I put gradle-wrapper.properties into my project then anybody who has access to my source code would would have access to my credentials. Alternatively, if I put the gradle-wrapper.properties file into my build image then all of my builds will be tied to the same credentials. Neither of these are acceptable.

What I’d much rather do is have Gradle Wrapper pick up it’s credentials from environment variables. My run-time environment makes it very easy to provide the credentials in this way - but is there a way to make Gradle consume the credentials from an environment variable?