Search code examples
jenkinsgroovyjenkins-pipelineshared-librariespipeline

groovy.lang.MissingMethodException: No signature of method: Why is this error coming for Jenkins Shared Pipeline library?


I have a shared pipeline library code. The library is loaded implicitly in my Jenkins and I'm calling one of the methods using the following code in my Jenkinsfile:

node {
    CheckOut {}
}

I've also tried using CheckOut.call() & CheckOut.call([:],{}) but to no avail. Keep getting the following error:

hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: CheckOut.call() is applicable for argument types: (org.jenkinsci.plugins.workflow.cps.CpsClosure2) values: [org.jenkinsci.plugins.workflow.cps.CpsClosure2@668faf1f]
Possible solutions: call(), wait(), any(), wait(long), main([Ljava.lang.String;), any(groovy.lang.Closure)

P.S. - The error is not specific to one function and is happening for all the other functions of the library as well.


Solution

  • Found the issue. While configuring the shared library repo in Jenkins Global Configuration, fill in the link without .git in the end.

    For example, use https://github.com/arghyadeep-k/jenkins-shared-library and not https://github.com/arghyadeep-k/jenkins-shared-library.git.

    And, then invoke the functions in your Jenkinsfile as

    node{
        checkOut.call()
    }