Issue
Instead of using def in my groovy scripts, I would like to be able to import the WorkflowScript class.
Instead of:
def script
I want:
WorkflowScript script
I want that because when I want to pass a script to a function, like get_branch(script)
it usually crash. For a weird reason it works with constructor, not methods.
For my IDE, I would also need to be able to get the dependency, which I do not find on maven, any way for that ?
Solution
I think this class is build dynamically to attach into it all available plugin extensions. But I think you can use super class for WorkflowScript
- CpsScript
:
import org.jenkinsci.plugins.workflow.cps.CpsScript
More information about the CpsScript
can be found here: https://javadoc.jenkins.io/plugin/workflow-cps/org/jenkinsci/plugins/workflow/cps/package-tree.html
Answered By - max.ivanch
Answer Checked By - David Goodson (JavaFixing Volunteer)