unable to resolve class JsonSlurper with script from Filesystem

3,215 views
Skip to first unread message

Alex Schwantes

unread,
Mar 8, 2016, 11:55:56 AM3/8/16
to job-dsl-plugin

Hi, 
I have a script like the following:

import groovy.json.JsonSlurper

def xxx = new JsonSlurper().parseText(inputFile.text)
...


When I use the option "Use the provided DSL script" and paste the script into the input box it works without issue. 
However when I use the option "Look on Filesystem" to read the file from disk (which was checked out from git), it throws the error:

unable to resolve class JsonSlurper 

Can anyone suggest why this might be the case and how to resolve it (if its not a bug)?

thanks


Alex Schwantes

unread,
Apr 9, 2016, 11:10:39 AM4/9/16
to job-dsl-plugin
Turns out it was due to a file encoding issue, where groovy couldn't load files saved in utf-8 encoding. After changing the file encoding it worked like a charm.
This old issue pointed me in the right direction https://issues.apache.org/jira/browse/GROOVY-2462 
Reply all
Reply to author
Forward
0 new messages