Issue
I'm in the midst of generating all our views using the Job DSL plugin.
The list views were created without a problem, but now I'm having troubles replacing my nested views.
If I copy & paste the example from href="https://jenkinsci.github.io/job-dsl-plugin/#path/nestedView" rel="nofollow noreferrer">https://jenkinsci.github.io/job-dsl-plugin/#path/nestedView , I get the following error:
ERROR: (ViewsGenerator.groovy, line 23) No signature of method: groovy.util.slurpersupport.NodeChild.call() is applicable for argument types: (foobar.jenkins.views.generator.ViewsGenerator$_run_closure1$_closure5) values: [foobar.jenkins.views.generator.ViewsGenerator$_run_closure1$_closure5@4e414e59]
Possible solutions: tail(), wait(), name(), max(), last(), any()
Line 23 is
views {
If I just use
nestedView('ZZZ_project-a') {
}
then Jenkins generates the nested view with that name, but of course it's empty!
I must be doing something very basic in a wrong way :-) but I can't figure it out! Any ideas?
I now tried using the given example directly in a Job DSL generator job (Use the provided DSL script
), and that works!
What is the difference between my Groovy script and the one in the textbox?
Solution
Ok, after a lot of banging my head on the table :-) I finally found the solution.
As usual, the problem is with my software :-)
I have a helper class called Views
which reads some XML etc. etc.
And there's a method called getViews()
in there.
For convenience, I usually import such helper classes with
import static Views.*
So, within the Job DSL's nestedView
there are views
, and apparently Groovy got confused about what views
to use, the ones from the Job DSL or my getViews()
.
I renamed that method to getAllViews()
, and the problem was solved.
But getting there (I'm by no means a Groovy expert) was a pretty hard experience, since the error message was very cryptic to me.
Answered By - eerriicc
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)