Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Gradle behind a firewall without setting a password, just a user?

Tags:

gradle

grails

Title says it all, I'm currently using a file in my '.gradle' directory called 'gradle.properties' to set systempProp.http.proxy* stuff. I've noticed that with Grails you don't need to set a http.proxy.proxyPassword just the http.proxHost, http.proxyPort, and http.proxyUser in the '.grails\ProxySettings.groovy' file.

Is there some systemProp/configuration I can use so I don't need to put my password in plaintext using Gradle?

like image 650
Lifeweaver Avatar asked Nov 24 '15 15:11

Lifeweaver


1 Answers

Gradle cannot eliminate the need for a password, if your proxy requires it. If you however do not want to check your password into code (clearly, that is a stupid thing to do :) ), you should use environment variables to hide it.

You can either set the env variable: http.proxyPassword to your password, or run gradle with a -D parameter:

gradle -Dhttp.proxyHost=***  -Dhttp.proxyPort=*** -Dhttp.proxyUser=**** -Dhttp.proxyPassword=****

Keep in mind that if someone else is building your code without proper env variables set, their build might fail, so remember to include proper instructions.

Also note that there is a different set of properties for https. Oh and if your proxy interferes with SSL certificates, you might also have to import your proxy certificates into your truststore.

like image 199
RaGe Avatar answered Oct 22 '22 12:10

RaGe