-
Bug
-
Resolution: Not A Defect
-
Minor
-
Job DSL Plugin 1.48
Jenkins 2.7.4
I am using the "configure" command to directly modify the XML since the Template Plugin is not supported directly.
This is simple groovy code that produces (in my opinion) a false ArrayIndexOutOfBoundsException:
job("Template Output Job") { String[] templates = ["Template1", "Template2"] for (int i = 0; i < templates.length; i++) { configure { it / "builders" << "hudson.plugins.templateproject.ProxyBuilder" { "projectName"(templates[i]); } } } }
I can easily fix this by using a temporary variable:
job("Template Output Job") { String[] templates = ["Template1", "Template2"] for (int i = 0; i < templates.length; i++) { String template = templates[i]; configure { it / "builders" << "hudson.plugins.templateproject.ProxyBuilder" { "projectName"(template); } } } }
There may be a good reason for this, but it is very strange from an end user point of view...