I'm new to Job DSL Plugin and even Groovy.
Given the following script:
class MyClass {
def create() {
folder('test') {
}
}
}
new MyClass().create()
I'm getting the following error:
javaposse.jobdsl.dsl.DslScriptException: (script, line 3) No signature of method: MyClass.folder() is applicable for argument types: (java.lang.String, MyClass$_create_closure1) values: [test, MyClass$_create_closure1@62591600] Possible solutions: find(), collect()
Ok, clear. Groovy does not find a method called "folder" in my class. But this isn't a method. It is a Job DSL command. How can I use them within my classes?
You need to pass the script reference into your class, see the Job DSL wiki .
class MyClass {
def create(def dslFactory) {
dslFactory.folder('test') {
}
}
}
new MyClass().create(this)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.