Groovy scripts failing when installed with Java 11


I have upgraded the Java version to 11 and the groovy started giving the following warnings when I run scripts

root@a71bdfc556cf:/opt/app# groovy -version
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/usr/share/groovy/lib/groovy-2.4.16.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Groovy Version: 2.4.16 JVM: 11.0.4 Vendor: Ubuntu OS: Linux

How can I eliminate these warnings?

1 Answer

5 years ago by

Try adding the following env property to your environment

GROOVY_TURN_OFF_JAVA_WARNINGS true

This should suppress the warnings in your case.

5 years ago by Karthik Divi