Groovy startup failed unexpected token
14,136
Thanks for the comments. After noting the versions you guys are using I updated to the latest and it now works. 'apt-get install' gave me 1.8 and I hadn't checked. Schoolboy.
Author by
Kevin
Updated on June 04, 2022Comments
-
Kevin almost 2 years
Excuse me if this is a silly question, I'm a complete Groovy noob and I'm tearing my hair out.
Trying to run an example groovy script:
@Grab('com.xlson.groovycsv:groovycsv:1.0') import static com.xlson.groovycsv.CsvParser.parseCsv def csv = '''Name:Lastname Mark:Andersson Pete:Hansen''' def data = parseCsv(csv, autoDetect:true) for(line in data) { println "$line.Name $line.Lastname" }
And getting the following error:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, /home/kmcghee/groovy/dev/import_csv/test: 2: unexpected token: import @ line 2, column 1. import static com.xlson.groovycsv.CsvParser.parseCsv
I've googled a lot on this and it appears to be related to Grapes but I can't pin down the issue. Any ideas?