I couldn't reopen GROOVY-2370, so I created a this new issue.
The script from GROOVY-2370 does indeed work correctly on my environment.
But I have attached a script that still fails.
It starts java from within the groovy script.
Antbuilder/Groovy ant task that uses forking java task causes StackOverflow in ANT script