Passwords and buildscript

I recently started using maven repo (proxy/nexus) instead of a shared network drive ivy repo because gradle was unable to cache “file:…” urls and every small network break (or something, never found out the actual reason) did confuse eclipse. (Also maintaining the repo manually became too hard work). Nexus seems superior in every but one area: a password is needed (I want authentication) whereas with ivy network drive was using OS level authentication.

I do not want to store the password in plain text anywhere if it can be avoided. So far has worked pretty well. Except I would like the build to be independent of the external network, so I would like to use the proxy even in the buildscript part. I is somewhat chicken and egg problem since I need the credentials plugin from somewhere. I could maybe store it in the version control but that seems counterintuitive because thats the reason I’m trying to use gradle in the first place (avoid storing libs in version control).

Any best practices how this should be done? Is it possible to apply a plugin for the buildscript part?

I would like the build be as portable as possible (within internal network)

1 Like

Hi Bjarne,

you can build and use a custom gradle distribution containing given credentials plugin :wink:

For examples see

Hope this helps

Hmm looks interesting, didn’t know this was possible. I might actually go with this solution :smiley: , or at least consider this as an option in the future. This would solve the problem I was thinking if I would use init scripts, but if they can be embedded to custom distribution, then people new to gradle (I would count myself to that category also) do not need to do that much work just to get the build running. Still there is the step to input/store the passwords with that plugin, but at least that needs to be done only once (which maybe needs to be done using another build.gradle since if it wont build without access to the repo, then the addCredentials task cannot be used).

It would be sort of nice if gradle would have the concept of a password storage similar to e.g. jenkins (enter them once and they you can select that use this with this build and so). (EDIT: meant built-in )