grails 4.0.10 的正确 build.gradle 转换器版本是什么?
在我的 Grails 4.0.10 构建中,我的默认 JSON 视图会抛出“NoSuchMethod”错误,
grails.core.GrailsDomainClass.getIdentifier()Lgrails/core/GrailsDomainClassProperty
此错误发生在这个简单的 Grails 控制台示例中:
import grails.converters.JSON
def obj = Organization.get(122L)
obj as JSON
我尝试了各种构建来消除该错误,包括:
compile 'org.grails.plugins:converters:4.0.0'
或者不指定任何内容,或者让版本默认为最新。在依赖关系报告中,我看到这些行,它们可能试图告诉我一些事情:
+--- org.grails:grails-datastore-rest-client -> 6.1.12.RELEASE
| +--- org.codehaus.groovy:groovy:2.4.11 -> 2.5.14
| +--- commons-codec:commons-codec:1.5 -> 1.11
| +--- org.grails:grails-plugin-converters:3.2.11
| | +--- org.codehaus.groovy:groovy:2.4.11 -> 2.5.14
| | +--- org.slf4j:slf4j-api:1.7.22 -> 1.7.30
| | +--- org.slf4j:jcl-over-slf4j:1.7.22 -> 1.7.30 (*)
| | \--- commons-lang:commons-lang:2.6
| +--- org.grails:grails-async:3.2.11 -> 4.0.0 (*)
| +--- org.grails:grails-core:3.2.11 -> 4.0.10 (*)
| \--- org.grails:grails-web:3.2.11 -> 4.0.10 (*)
并从我们的一个插件中做出贡献:
+--- org.grails.plugins:converters:4.0.0 -> 4.0.1 (*)
从 Grails 3.2.13 升级后,我需要做什么才能让 JSON 视图再次工作?
With my Grails 4.0.10 build my default JSON views throw a "NoSuchMethod" error with
grails.core.GrailsDomainClass.getIdentifier()Lgrails/core/GrailsDomainClassProperty
This error occurs from this simple Grails console example:
import grails.converters.JSON
def obj = Organization.get(122L)
obj as JSON
I have tried various builds to get rid of the error, including this:
compile 'org.grails.plugins:converters:4.0.0'
or not specifying anything, or let the version default to the latest. In the dependency-report I see these lines, which may be trying to tell me something:
+--- org.grails:grails-datastore-rest-client -> 6.1.12.RELEASE
| +--- org.codehaus.groovy:groovy:2.4.11 -> 2.5.14
| +--- commons-codec:commons-codec:1.5 -> 1.11
| +--- org.grails:grails-plugin-converters:3.2.11
| | +--- org.codehaus.groovy:groovy:2.4.11 -> 2.5.14
| | +--- org.slf4j:slf4j-api:1.7.22 -> 1.7.30
| | +--- org.slf4j:jcl-over-slf4j:1.7.22 -> 1.7.30 (*)
| | \--- commons-lang:commons-lang:2.6
| +--- org.grails:grails-async:3.2.11 -> 4.0.0 (*)
| +--- org.grails:grails-core:3.2.11 -> 4.0.10 (*)
| \--- org.grails:grails-web:3.2.11 -> 4.0.10 (*)
and contributing from one of our plugins:
+--- org.grails.plugins:converters:4.0.0 -> 4.0.1 (*)
What do I need to do to get the JSON views working again after the upgrade from Grails 3.2.13?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
默认情况下,Grails 4.0.10 项目将依赖于
compile "org.grails:grails-plugin-rest"
(如果构建尚未修改,则默认为 4.0.10)并且该工件对 org.grails.plugins:converters:4.0.1 具有传递依赖关系。By default a Grails 4.0.10 project will have a dependency on
compile "org.grails:grails-plugin-rest"
(will be 4.0.10 by default if the build hasn't been modified) and that artifact has a transitive dependency onorg.grails.plugins:converters:4.0.1
.我的案例的答案,经过一番努力,build.gradle:
和
The answer for my case, after much ado, build.gradle:
and