Last Updated: February 25, 2016
·
6.044K
· steviebraga

Working with Grails behind a proxy

When you're working with Grails behind a proxy, you might not be able to download dependencies or plugins. Looking up for solutions, I found this one:

  • Create a file called ProxySettings.groovy in a directory called .grails in your user home. In my case: "/Users/steviebraga/.grails"

  • You can register more than one proxy configuration. For each one you must write a line with the following structure:

{your_proxy_id}=["http.proxyHost":"{your_proxy_host}", "http.proxyPort":"{your_proxy_port}", "http.proxyUser":"{your_proxy_username}", "http.proxyPassword":"{your_proxy_password}"]
  • Write a line defining which proxy use:
currentProxy="proxy_id"

In the end the file should look like something like this:

workProxy=["http.proxyHost":"proxy.work.com", "http.proxyPort":"8080", "http.proxyUser":"myusername", "http.proxyPassword":"areallysecureone"]
collegeProxy=["http.proxyHost":"200.150.1.100", "http.proxyPort":"3030", "http.proxyUser":"anotherusername", "http.proxyPassword":"anothergreatpassword"]
currentProxy="workProxy"