1

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?

M. Justin
  • 14,487
  • 7
  • 91
  • 130
Lars Nordin
  • 2,785
  • 1
  • 22
  • 25
  • Does your proxy require authentication? – tim_yates Jan 11 '19 at 19:35
  • Actually, the corporate one does, hence I have a local cntlm proxy that proxies my local Linux connections to the Internet via that corporate proxy since they can't do Windows NTLM auth. I can run a browser on my Linux system and it reaches the Internet via the local cntlm proxy. – Lars Nordin Jan 11 '19 at 20:47
  • 1
    You could try to add the corresponding https settings, even though the groovy docs don't mention them? `The https (http over SSL) protocol handler has its own set of properties` https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html – andi Jan 12 '19 at 14:23

2 Answers2

1

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')
])
...
emilles
  • 1,104
  • 7
  • 14
1

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!

Lars Nordin
  • 2,785
  • 1
  • 22
  • 25