Archive

Archive for the ‘Proxy Config’ Category

Proxy Management for Gradle, Eclipse and Grails…

March 19, 2014 1 comment

This is an ever thorny subject and scope for much pain for users including myself

So thought i’d catalog the best way to set this up when working behind a firewall

starting with
Gradle

Best way for gradle is to add gradle.properties file into into the root of your project or into into USER_HOME/.gradle (user wide config)

basic attributes you may need to set are gradle.properties

systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password

then refresh the dependencies (say from within your eclipse build with Gradle project support enabled)

Grails Projects

For Grails projects (v2 onwards) you can creat a ProxySettings.groovy file in the “${userHome}/.grails/scripts/ProxyConfig.groovy” directory and refresh the grails dependencies (note: this is global to all projects) where the file format is like this

MyProxy=['http.proxyHost':'xx.xx.xx.xx', 'http.proxyPort':'8080', 'http.proxyUser':'', 'http.proxyPassword':'', 'http.nonProxyHosts':'my_maven_server']
currentProxy='MyProxy'

alternatively you are supposed to be able run the following commands on grails

grails add-proxy proxyConf –host=proxy-server –port=4300
–username=guest –password=guest
grails set-proxy proxyConf

though i’m not certain that i have had this work in call cases but adding the file seems to.

lastly if that doesn’t work – you can try and edit your projects /conf/BuildConfig.groovy and add the following to that file

System.properties.putAll([
   "http.proxyHost": "myproxy.hostname.com",
    "http.proxyPort": "8080",
    "http.proxyUserName": "myUser",
    "http.proxyPassword": "myPass"
])

Eclipse itself

best i have found Eclipse itself is to add the proxy in the eclipse.ini file (or GGTS.ini etc ) with your eclipse build

you need to be careful – there can be no spaces round the definition else Eclipse doesn’t seem to read it correctly

You need to specify the following options below the -vmargs option in the .ini file, each on a separate line and spare whitespace at the end etc
-Dhttp.proxyPort=8080
-Dhttp.proxyHost=www.somehost.org
-Dhttp.proxyUser=mydomain\myusername
-Dhttp.proxyPassword=mypassword
-Dhttp.nonProxyHosts=localhost|127.0.0.1

and if this doesnt work you can try adding
-Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer

and try again.

Good luck

%d bloggers like this: