Cannot instantiate an object in Jenkins Shared Library

旧巷老猫 提交于 2019-12-12 20:14:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!