Reputation: 1760
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 ?
Upvotes: 4
Views: 3415
Reputation: 349
One more option I have found
Script script
And you don't need to import anything more.
Upvotes: 0
Reputation: 349
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
Upvotes: 8