What is the correct build.gradle converters version for grails 4.0.10?

326 Views Asked by At

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?

2

There are 2 best solutions below

6
Jay On

The answer for my case, after much ado, build.gradle:

classpath 'org.grails.plugins:converters:4.0.1'

and

compile 'org.grails.plugins:converters:4.0.1'
0
Jeff Scott Brown On

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 on org.grails.plugins:converters:4.0.1.