Tuesday, March 4, 2008

GroovyConsole and proxyHost and proxyPort

I was working with Groovy and experimenting with GroovyWS. I tried a simple Web Service script and tried executing it but was blocked by my firewall.

The first thing I looked at is how to set -DproxyHost and -DproxyHost.

I set this at the groovy command line and everything was groov-eh.

But, when I tried to utilize GroovyConsole it did not have any option to set the proxyPort or proxyHost.

So, what to do:
- Went to Groovy/bin
- created a proxyGroovyConsole.bat (copy GroovyConsole.bat)
- created a proxyStartGroovy.bat (copy StartGroovy.bat)
- in proxyStartGroovy.bat
add the following lines:
set JAVA_OPTS=%JAVA_OPTS% -DproxySet="true"
set JAVA_OPTS=%JAVA_OPTS% -DproxyHost="x.com"
set JAVA_OPTS=%JAVA_OPTS% -DproxyPort="1234"

- change proxyGroovyConsole.bat to call proxyStartGroovy.bat

= works!!!

So, why go through the pain of creating another proxyFile? why not make the changes in the same file?
- because @ work I need to use proxy
- @ home no proxy!!

I could've set Windows env variables, but that poses the same problems too.
So, the simple minimalistic way is to create a separate BAT file

1 comment:

Anonymous said...

thank you very much for this