def setName(value) {
this.name = value;
}
def getName() {
return this.name;
}
def caution(message) {
echo "Hello, ${this.name}! CAUTION: ${message}"
}
My pipeline script in a Jenkins2 pipeline project:
acme.name = 'Alice'
echo acme.name
acme.caution 'The queen is angry!'
The two first lines, setting and getting the name works fine.
But when I include the last line, calling the "caution" function the script fails with
hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: static Alice.caution() is applicable for argument types: (java.lang.String) values: [The queen is angry!]
Possible solutions: caution(java.lang.Object), wait(), main([Ljava.lang.String;)
at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1503)
at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1489)
at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:53)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:18)
at WorkflowScript.run(WorkflowScript:8)
If I remove the first 2 lines of the pipeline script, leaving only the "acme.caution" call, the error detail is changed to
hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: static acme.caution() is applicable for argument types: (java.lang.String) values: [The queen is angry!]
Jenkins version 2.41
Pipeline plugin 2.4