Error when creating a job: No signature of method: job() is applicable for argument types:

53 views
Skip to first unread message

eid badr

unread,
Dec 21, 2016, 7:31:12 AM12/21/16
to job-dsl-plugin
Hallo
I have two files: Main.groovy, Base.groovy, Main calls the build method in Base:

When I start the script I got the following error:

Processing DSL script Main.groovy
ERROR: (Base.groovy, line 144) No signature of method: Base.job() is applicable for argument types: (java.lang.String, Base$_createBuildAndCopyToUserContentJob_closure5) values: [win32_TestZISSynchronisation_BuildAndCopyToUserContent, Base$_createBuildAndCopyToUserContentJob_closure5@10788531]
Possible solutions: any(), wait(), grep(), find(), dump(), is(java.lang.Object)
Finished: FAILURE



line 144 is  
job(strJobName) {

How can I correct this?


Main.groovy:
Base base = new Base()
base.createBuildAndCopyToUserContent(alltests, propertiesFile, "${js_sandbox32_home}", "${js_sandbox64_home}", JENKINS_HOME)


Base.groovy:
def createBuildAndCopyToUserContent(alltests, propertiesFilePath, js_sandbox32_home, js_sandbox64_home, JENKINS_HOME) {
        alltests.each { test ->
           
if (test.runTest) {
                createBuildAndCopyToUserContentJob(test, test.platform, propertiesFilePath, js_sandbox32_home, js_sandbox64_home, JENKINS_HOME)
           
}
       
}
   
}


def createBuildAndCopyToUserContentJob(test, platform, propertiesFilePath, js_sandbox32_home, js_sandbox64_home, JENKINS_HOME) {
     String strJobName = test.name 
     job
(strJobName) {



Daniel Spilker

unread,
Dec 21, 2016, 7:43:35 AM12/21/16
to job-dsl...@googlegroups.com
The top-level DSL methods are only available in the (main) script, but not in helper classes. You need to pass a reference to the script (this) into the helper class:

See https://github.com/jenkinsci/job-dsl-plugin/wiki/Job-DSL-Commands#dsl-factory

Daniel

--
You received this message because you are subscribed to the Google Groups "job-dsl-plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugin+unsubscribe@googlegroups.com.
To post to this group, send email to job-dsl-plugin@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/3668a8d2-b26f-414f-9229-202835f40959%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages