I am having an issue extending a utilizing a jobdsl command from a groovy script.
I have created a helper class and i am passing "this". It works for jobdsl commands that do not require closures. But fails with invalid property for job dsl command that accepts closures. Example is the freestylejob("inputstring"){}
Helper Code
static freeJob(def fJ, def dslFactory){
def txt = dslFactory.freeStyleJob(fJ){
}
}
Caller Code
def testjob = DS.freeJob("inputstring", this)
I expect no errors. Instead i am getting the error below from jenkins.
ERROR: (filename.groovy, line 119) No signature of method: .filename.freeStyleJob() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl, classname$_classname_closure3) values: [inputstring, classname$_project_closure3@5c7bc682]
The code was calling the method from a class deep. Issue resolved.