'Import Jenkins WorkflowScript class

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 1:[1]

One more option I have found

Script script

And you don't need to import anything more.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 max.ivanch