问题
Currently I am working on creating a Jenkins shared library in my project and facing a problem trying to instantiate an object.
Tree structure of my application
- day#1
-- ./Jenkinsfile
-- ./src/File1.groovy
-- ./test/File1Spec.groovy
-- ./vars/file1.groovy
From my Jenkinsfile I can call file1.function which inturn will create a class object written in the file ./src/File1.groovy and it works perfectly, But on day#2, I add one more class(src/File2.groovy) and tried to create an object in vars/file2.groovy and it fails with the following error:
"com.cloudbees.groovy.cps.impl.CpsCallableInvocation"
"Finished: FAILURE"
- day#2
-- ./Jenkinsfile
-- ./src/File1.groovy
-- ./src/File2.groovy
-- ./test/File1Spec.groovy
-- ./test/File2Spec.groovy
-- ./vars/file1.groovy
-- ./vars/file2.groovy
Can anyone give me a clue how this can be solved?
/Prasanth
回答1:
CpsCallableInvocation means that you called a CPS method like echo
from within a NonCPS
method or a constructor. Check your code for that.
来源:https://stackoverflow.com/questions/48932971/cannot-instantiate-an-object-in-jenkins-shared-library