1

我的 buildConfig 中有以下内容:

compile ":json-rest-api:1.0.11"

当我通过 Eclipse STS 查看我的类路径下的依赖项时,我可以看到simple-json-1.1.jar包含在内。

当我为部署构建战争时,我发现它不包括这个 jar。我在部署中需要它来测试推送通知。我目前收到当前错误,因为缺少该类:

2013-02-11 08:55:46,390 ERROR [STDERR] (Thread-85) org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NoClassDefFoundError: org/json/simple/parser/ParseException
2013-02-11 08:55:46,390 ERROR [STDERR] (Thread-85)      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:97)
2013-02-11 08:55:46,390 ERROR [STDERR] (Thread-85)      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
2013-02-11 08:55:46,390 ERROR [STDERR] (Thread-85)      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1047)
2013-02-11 08:55:46,390 ERROR [STDERR] (Thread-85)      at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
2013-02-11 08:55:46,390 ERROR [STDERR] (Thread-85)      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:877)
2013-02-11 08:55:46,390 ERROR [STDERR] (Thread-85)      at groovy.lang.Closure.call(Closure.java:412)
2013-02-11 08:55:46,390 ERROR [STDERR] (Thread-85)      at groovy.lang.Closure.call(Closure.java:406)
2013-02-11 08:55:46,391 ERROR [STDERR] (Thread-85)      at groovy.lang.Closure.run(Closure.java:490)
2013-02-11 08:55:46,391 ERROR [STDERR] (Thread-85)      at java.lang.Thread.run(Thread.java:619)
2013-02-11 08:55:46,391 ERROR [STDERR] (Thread-85) Caused by: java.lang.NoClassDefFoundError: org/json/simple/parser/ParseException
2013-02-11 08:55:46,391 ERROR [STDERR] (Thread-85)      at java.lang.Class.forName0(Native Method)
2013-02-11 08:55:46,391 ERROR [STDERR] (Thread-85)      at java.lang.Class.forName(Class.java:169)
2013-02-11 08:55:46,391 ERROR [STDERR] (Thread-85)      at com.mysite.notification.AndroidNotificationService.class$(AndroidNotificationService.groovy)
2013-02-11 08:55:46,391 ERROR [STDERR] (Thread-85)      at com.mysite.notification.AndroidNotificationService.$get$$class$com$google$android$gcm$server$Sender(AndroidNotificationService.groovy)
2013-02-11 08:55:46,391 ERROR [STDERR] (Thread-85)      at com.mysite.notification.AndroidNotificationService.sendMessage(AndroidNotificationService.groovy:22)
2013-02-11 08:55:46,393 ERROR [STDERR] (Thread-85)      at com.mysite.notification.AndroidNotificationService$$FastClassByCGLIB$$5e8e3148.invoke(<generated>)

我需要在某处明确设置吗?它甚至是 json-rest-api 插件的依赖项吗?

谢谢

4

1 回答 1

3

因此,在按照 Ian 的建议使用 grails dependency-report 之后,我发现它来自com.googlecode.json-simple

我将以下内容添加到我的 buildConfig.groovy 中,并在构建时正确拉入:

dependencies {      
        compile 'org.json-simple:json-simple:1.1.1'
}
于 2013-02-12T11:16:32.990 回答