groovy grape grab not using proxy settings

2.1k Views Asked by At

I'm running Groovy v2.4.5 behind a firewall and I have a local cntlm proxy. FYI, when I use grab on open networks, it works.

I've tried running my script this way:

groovy -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128 -Divy.message.logger.level=3 try_grape_grab.groovy

And settings those same properties in JAVA_OPTS but groovy doesn't seem to use them, I just see that the download hangs.

export JAVA_OPTS="-Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128"

If I use a browser (with proxy settings) I can access the pom that grab is trying to download, so the web proxy is not blocking access to those files either.

Note - I've tried the same with the grape command as well but no luck.

Any ideas?

2

There are 2 best solutions below

0
Lars Nordin On BEST ANSWER

The comment by andi was the key - I needed to proxy HTTPS also (doh!). It worked once I changed how I ran the script to:

groovy -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3128 -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128 -Divy.message.logger.level=3 try_grape_grab.groovy

Thanks Andi!

0
emilles On

I think you need to use @GrabConfig to do this. Inside your try_grape_grab.groovy:

@Grapes([
  @Grab('some:thing:1.0'),
  @GrabConfig(systemProperties='httpProxy.host=127.0.0.1,httpProxy.port=3128')
])
...