ScaryGhast ScaryGhast - 1 year ago 125
Groovy Question

What's the syntax to create a Serializable Groovy Class for Jenkins Workflow/Pipeline

Working with Jenkins Workflow Groovy, I'm running into Serialization errors when trying to create objects for a dead simple class. What kind of syntactic sugar is required to pass the serializable test? The following code is failing. Adding the @Serializable line fails with "class is not an annotation in"

class TestClass {
def hello() {
println "halloooo"
def myobj = TestClass.newInstance()
node () {

Answer Source

Credit to izzekil for answering this.

class TestClass implements Serializable {}