Work around groovy failure with some JRE-s

by compiling some .groovy files instead of interpreting them
Add comment to workaround
Merge pull request #3907 from rbalint/groovy-workaround

Work around groovy failure with some JRE-s