Groups
Groups
Sign in
Groups
Groups
Jenkins Users
Conversations
About
Send feedback
Help
groovy compilation error when submitted with 'curl' comman
52 views
Skip to first unread message
rchen
unread,
Jan 10, 2015, 5:18:25 PM
1/10/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jenkins...@googlegroups.com
Hi,
I am trying to submit following groovy script to a Jenkins server with curl command, but got compilation error. It has no problem if I run it in Jenkins script console. Here is my groovy script 'groovy5':
script=for (item in Jenkins.instance.items) {
println "
item.class.name
";
if (
item.class.name
== "hudson.model.FreeStyleProject") {
if (item.lastBuild != null) {
if(item.lastBuild.result == hudson.model.Result.FAILURE) {
println (" "+
item.name
) ; /* No problem if : println (item.name); */
}
}
}
}
Here is the curl command and error message
o7devl@my-machine:~
> curl -s -d @groovy5 -X POST
http://o7devl:apitoken@jenkinsserver:28080/jenkins/scriptText
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 1: unexpected token: item @ line 1, column 307.
println (" "
item.name
)
^
1 error
It looks like the '+' operator got erased.In additon, if I combine the inner 2 if statement like this:
if (item.lastBuild != null && item.lastBuild.result == hudson.model.Result.FAILURE)
I got this error:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 1: expecting ')', found '' @ line 1, column 190.
if (item.lastBuild != null
^
The && sign looks like get lost. What cause this problem? Thanks.
Reply all
Reply to author
Forward
0 new messages