Cannot instantiate an object in Jenkins Shared Library
Asked Answered
K

1

2

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

Kvass answered 22/2, 2018 at 16:50 Comment(1)
Can you show us what src/File2.groovy and vars/file2.groovy have inside?Romelda
K
7

CpsCallableInvocation means that you called a CPS method like echo from within a NonCPS method or a constructor. Check your code for that.

Kingofarms answered 23/2, 2018 at 20:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.