groovy under eclipse un resolved groovy.json.JsonSlurper

  Kiến thức lập trình

I have installed the eclipse groovy plugin here

I created new groovy project and add new groovy script file to it to test.

I was trying to do json manipulation so I copied the following code to my script:

import groovy.json.JsonSlurper

def jsonSlurper = new JsonSlurper()
def object = jsonSlurper.parseText('{ "name": "John", "ID" : "1"}')
  
println(object.name);
println(object.ID);    

I start getting error of unresolved class path for groovy.json.JsonSlurper!! This is strange because if I run the command groovyconsole and run the script from their editor it runs fine! and I dont get this error:

I check the environment variables and the GROOVY_HOME is there and the bin folder is added to the Path env variable.

Why im getting this error? Why the plugin is failing to compile correctly despite groovy is installed and all the environment vairables are configured appropriately ? Shouldnot the plugin point to the default groovy lib based on the environment variables?

This is frustrating….

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT