简体   繁体   中英

Jenkins - load a groovy file into a DSL file

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?

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 .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM