The extension method's signature is static String asJsonString(Closure self) (https://github.com/elasticsearch/elasticsearch-groovy/blob/v1.4.2/src/main/groovy/org/elasticsearch/groovy/common/xcontent/XContentBuilderExtensions.groovy#L97).
Tested on both a Mac and Linux (with and without --indy does not matter):
- Groovy Version: 2.3.9 JVM: 1.8.0_25 Vendor: Oracle Corporation OS: Mac OS X
- Groovy Version 2.3.9 JVM: 1.7.0_65 Vendor: Oracle Corporation OS: Linux
However, if I don't use Grape/the GroovyShell, then the same code works with the same dependencies. I always use Gradle to build my code, so it wasn't until a user pointed this issue out that I became aware of it.
This relates to
GROOVY-6557. On my Mac, I was always able to reproduce GROOVY-6447, but my core issue appears to relate to Closure extension methods across multiple platforms (https://github.com/elasticsearch/elasticsearch-groovy/issues/19).