I have a groovy script to create the folders for my Jenkins server. The folders plugin is installed and working. I also installed the Job DSL plugin and created the Seed job. There are 2 options for supplying the groovy DSL code. 1. Use the provided DSL script or 2. Look on the filesystem.
If I use option 1 and supply this script it works perfectly and I see the folders:
def folders = '''
Active Folder
Active Folder/DqCpi
Active Folder/DqCtlRent
Active Folder/DqFileBox
'''
def folderList = folders.tokenize('\n')
for (folderName in folderList) {
folder(folderName)
}
So far so good.
I save this code into Folders.groovy inside the seed job's workspace folder then try option 2
This fails and the error message in the console is:
Processing DSL script Folders.groovy
ERROR: (Folders.groovy, line 1) No signature of method: Folders.?def() is applicable for argument types: (java.lang.String) values: [
Active Folder
Active Folder/DqCpi
Active Folder/DqCtlRent
Active Folder/DqFileBox
]
Possible solutions: grep(), folder(java.lang.String), job(java.lang.String), queue(java.lang.String), use([Ljava.lang.Object;), grep(java.lang.Object)
Finished: FAILURE
The file Folders.groovy is saved in UTF8 format.
Why does in the inline version work and the file version fail?