0

I want to load a groovy file in a DSL file. If I process the DSL file I got following error message:

Processing DSL script folderA/job.dsl
ERROR: (job.dsl, line 2) No signature of method: job.load() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl) values: [./build.groovy ]
Possible solutions: find(), job(java.lang.String), find(groovy.lang.Closure), wait(), run(), run()

The first two lines of my file job.dsl:

def workspace = '.'
def module = load "${workspace}/build.groovy "

I understand the error message in this way, there is no method load() in object job. The question is, how can I access global/build-in methods like load() in a DSL file?

Andreas
  • 292
  • 3
  • 7

1 Answers1

0

According to the message there is no load() method with a signature that contains a groovy.lang.GString parameter.

You could use:

without interpolation which are interpreted as java.lang.String.

See also Load script from groovy script.

Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
  • Thank you for your answer. But this doesn't help. :-( Now I get the following error message: ERROR: (job.dsl, line 2) No signature of method: job.load() is applicable for argument types: (java.lang.String) values: [./build.groovy] Possible solutions: job(java.lang.String), find(), folder(java.lang.String), job(java.lang.String, groovy.lang.Closure), find(groovy.lang.Closure), wait() -- This is nearly the same, but only the argument type is different. – Andreas Nov 22 '21 at 08:59
  • @Andreas Where did you get the info that `load()` is the right method? It isn't mentioned a single time in the question & answers I linked to. – Gerold Broser Nov 22 '21 at 09:17