无法解析类groovy.json.jsonSlurpe

p3rjfoxz  于 2023-03-17  发布在  其他
关注(0)|答案(3)|浏览(355)

我收到以下返回的错误消息:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script3.groovy: 1: unable to resolve class groovy.json.JsonSlurpe @ line 1, column 1. import groovy.json.JsonSlurpe ^ 
    org.codehaus.groovy.syntax.SyntaxException: unable to resolve class groovy.json.JsonSlurpe @ line 1, column 1. at 
    org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:149) at 
    org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1225) at 
    org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:178) at 
    org.codehaus.groovy.control.CompilationUnit$11.call(CompilationUnit.java:651) at 
    org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:931) at 
    org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593) at 
    org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:542) at
olhwl3o2

olhwl3o21#

试着把第一行改一下。小小的错别字。

发件人:

import groovy.json.JsonSlurpe

收件人:

import groovy.json.JsonSlurper
ukxgm1gy

ukxgm1gy2#

你的第一句台词应该是这样的...
导入net.sf.json.groovy.jsonslurper
这对我很有效。

5gfr0r5j

5gfr0r5j3#

确保类路径上有groovy.json,例如dependent on

<dependency>
    <groupId>org.apache.groovy</groupId>
    <artifactId>groovy-json</artifactId>
</dependency>

<dependency>
    <groupId>org.apache.groovy</groupId>
    <artifactId>groovy-all</artifactId>
</dependency>

相关问题