How do I find out Groovy runtime version from a running app?

To improve slightly on tim_yates' answer, here's the universal code to get Groovy version:

public String getGroovyVersion() {
        try {
                return org.codehaus.groovy.runtime.InvokerHelper.version
        }
        catch (Throwable ignore) { }
        return GroovySystem.version
}

println getGroovyVersion()

This should work:

println GroovySystem.version

So long as you are on Groovy 1.6.6+

Before that, it was:

println org.codehaus.groovy.runtime.InvokerHelper.version

But that's been removed from later versions of Groovy

Tags:

Groovy