Daniel Spilker resolved Bug JENKINS-27318 as Not A Defect

Your name variable clashes with the name() method. In Groovy it's possible to assign a code block (called Closure) to a variable and then call that variable using the round brackets:

def a = { println 'HELLO' }
a()

In your case, Groovy is trying to call the name variable and a String can't be called which leads to the exception.


To fix the problem, use a different variable name:

def views = ['-Default-':[regex:'.*-default\$'],
		 '9.3':[regex:'.*-9\\.3\$']]
views.each { viewName, cfg -> 
  listView(viewName) {
    jobs {
      regex(cfg.regex)
    }
    columns {
      status()
      weather()
      name()
      lastSuccess()
      lastFailure()
      lastDuration()
      buildButton()
    }
  }
}

Please use the mailing list for DSL syntax related questions: https://groups.google.com/forum/?fromgroups#!forum/job-dsl-plugin

Change By: Daniel Spilker (10/Mar/15 10:24 PM)
Status: Open Resolved
Resolution: Not A Defect
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to