Java – what is the syntax for creating serializable groovy classes for Jenkins workflows / pipes

When using Jenkins workflow groovy, I encountered a serialization error while trying to create an object for a dead simple class What syntax sugar is required to pass serializable tests? The following code failed Failed to add @ serializable line, "class java.io.serializable is not a comment in @ java.io.serializable"

//@Serializable 
class TestClass { 
    def hello() { 
        println "halloooo" 
    } 
} 
def myobj = TestClass.newInstance() 
node () { 
    myobj.hello() 
}

Solution

Thanks izzekil for answering this question

class TestClass implements Serializable {}
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>