Issue
My operations center cluster operations that use the step Execute Groovy Script on Controller
with a Groovy snippet similar to the one below started to fail since I migrated to Java 11.
def testFnc(string) { return string } println(testFnc("Hello"))
Explanation
The issue described above will fail only if the cluster operations are executing a function in the Groovy snippet and the name of the cluster operations is not Java-compliant. For example, this issue is reproducible if the cluster operations name is groovy-with-function_script
, and the build will fail with the following log:
Caused by: java.lang.ClassFormatError: Illegal class name "groovy-with-function_script$testFnc" in class file groovy-with-function_script$testFnc at groovy.lang.GroovyShell.evaluate(GroovyShell.java:612) [...]
Resolution
This issue will be fixed in a future CloudBees CI release, and this article will be updated with the specific version number with the fix.
Workaround
As mentioned in the explanation section, this issue is only reproducible if the cluster operations are executing a function in the Groovy snippet and the name of the cluster operations is not Java-compliant. Therefore, to work around this issue, you have to use a Java-compliant name for the cluster operations. For example, instead of using groovy-with-function_script
as indicated in the example above, you should use GroovyWithFunction
.