ender
ender

Reputation: 486

Setup Grails in GGTS 3.4 behind Proxy

I wish to share the knowledge that how I fix the proxy problem to setup GGTS in my company's PC after I run the setup.exe of GGTS 3.4 downloaded from SpringSource (by googling for a whole day around www ;))

Problem:

When I start to build my hello world project after the IDE installation, GGTS prompts me this error message: "Error Failed to resolve dependencies". How to fix it?

Upvotes: 1

Views: 6553

Answers (6)

ian0411
ian0411

Reputation: 4265

Here is how I fixed the problem for myself for Grails version 2:

  1. Go to C:\Users\\[your username]\\.grails folder, make a file called ProxySettings.groovy.

  2. Inside that ProxySettings.groovy file, add the following two lines:

client=['http.proxyHost':'the proxy host', 'http.proxyPort':'the port number', 'http.proxyUser':'username', 'http.proxyPassword':'password']

currentProxy='client'

For example you can have something like this in the file:

client=['http.proxyHost':'1.1.1.1', 'http.proxyPort':'8080', 'http.proxyUser':'batman', 'http.proxyPassword':'superman']

currentProxy='client'

This does the trick for me and hope this will help you too.

Upvotes: 0

John Tolentino
John Tolentino

Reputation: 13

grails add-proxy client "--host=your.proxy.com" "--port=xxxx" "–noproxy='localhost'"
grails set-proxy client

Then replace maven with ivy in your project's BuildConfig.groovy.

Upvotes: 0

Ehsan Gholami
Ehsan Gholami

Reputation: 87

Edit File ProxySettings.groovy in windows User directory C:\Users\YourUser

client=['http.proxyHost':'proxy host address', 'http.proxyPort':'proxy host port', 'http.proxyUser':'', 'http.proxyPassword':'']

currentProxy='client'

Upvotes: 0

ender
ender

Reputation: 486

I'll answer my own question:

  1. Go to IE and find the proxy url from the specific proxy file (in Internet Connection Settings), or just ask your firm's support guys.

  2. Go to your grails' bin folder and run this:

    grails add-proxy client "--host=your.proxy.com" "--port=xxxx" "–noproxy='localhost'"
    
  3. It will give you a line of feedback like: "Added proxy client to \\path.grails\ProxySettings.groovy". Now you should open the file, check the url, port, username & password, and also make sure it contains a second line like this: currentProxy='client'

  4. There is an article suggesting changing a string in the first line of the ProxySettings.groovy from http.proxyUser to http.proxyUserName. In my own case the proxy doesn't require un/pw so not sure if it is vital or not (source: http://web.archive.org/web/20130910035021/http://jira.grails.org/browse/GRAILS-10097)

  5. Now right click the project in GGTS, Grail Tools > Refresh Dependencies, or just re-create the hello world project. Huray!

Upvotes: 5

Hank
Hank

Reputation: 231

If you are running GGTS first time behind your company proxy you might get this Error:

Solution: Go to C:\Users\[your username]\.grails folder, Add a folder name called ProxySettings.groovy.

Expected

Open ProxySettings.groovy file with notepad and add these Two following line:

client=['http.proxyHost':'Proxy Host Address', 'http.proxyPort':'port Number', 'http.proxyUser':'username', 'http.proxyPassword':'password']
currentProxy='client'

Note: Don't Remove single quote.

Final: For Me The content inside file look like Below:

client=['http.proxyHost':'192.150.1.1', 'http.proxyPort':'80', 'http.proxyUser':'Vineet', 'http.proxyPassword':'GoGetHigh']
currentProxy='client'

Upvotes: 0

Kamil Mikolajczyk
Kamil Mikolajczyk

Reputation: 911

ender's answer is fine when you have already run the project at least once, but recently I had a situation where I checked out my project from git on a computer behind a proxy, and I couldn't do "grails add-proxy" because I was behind a proxy and it couldn't get grails dependencies from repos :) in that case, the solution is to do System.setProperty("http.proxyHost", yourProxy) in BuildConfig.groovy like this:

grails.project.dependency.resolution = {
    System.setProperty("http.proxyHost", yourProxy);
    System.setProperty("http.proxyPort", yourProxyPort);

    ...
}

Upvotes: 1

Related Questions