No signature of method: javaposse.jobdsl.dsl.helpers.workflow.CpsContext.readFileFromWorkspace()

2,631 views
Skip to first unread message

Catalin P

unread,
Jun 13, 2017, 5:43:00 PM6/13/17
to job-dsl-plugin
Hi,

I have created a groovy script which imports a script form the resource folder.

The src script looks like below:

############
package example

import javaposse.jobdsl.dsl.*
.........................................
class MyClass {

    String name
    String remoteFile = 'resources/common/groovy/pipelines/codeBuld/v1.groovy'

  Job build(DslFactory dslFactory) {
      dslFactory.pipelineJob(name) {
.........................................
          definition {
              cps {
                script(readFileFromWorkspace(remoteFile))
                  sandbox()
              }
          }
############

When the seed job tries to create the jobs I get the error:

ERROR: (MyClass.groovy, line 45) No signature of method: javaposse.jobdsl.dsl.helpers.workflow.CpsContext.readFileFromWorkspace() is applicable for argument types: (java.lang.String) values: [resources/common/groovy/pipelines/codeBuld/v1.groovy]


I am not sure what I am doing wrong. Can I have some help please?

I get the same error on: 
- Jenkins 2.32, 2.46.3 and 2.65
- Job DSL  1.63

Many thanks

Matt Sheehan

unread,
Jun 13, 2017, 11:31:39 PM6/13/17
to job-dsl-plugin
It should work if you do:

script(dslFactory.readFileFromWorkspace(remoteFile))

--
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-plugi...@googlegroups.com.
To post to this group, send email to job-dsl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/225c75ec-3340-4443-b842-5ab7547feec3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Catalin P

unread,
Jun 14, 2017, 3:20:50 AM6/14/17
to job-dsl-plugin
Many thanks Matt. It's working.
Reply all
Reply to author
Forward
0 new messages