-
Notifications
You must be signed in to change notification settings - Fork 34
Description
Because this plugin embeds a GsonUnitTestMixin class which inherits from GsonUnitTestMixin, makes it dependant to grails-test, grails-plugin-testing and spring-test artifacts. This is particularly a problem if someone (me) wants to use this plugin in a mavenized grails project.
If I simply add a dependency to this plugin in the pom.xml file, executing a mvn test leads to a compilation error on GsonUnitTestMixin.groovy because GsonUnitTestMixin class cannot be resolved.
I tried to change the scope of both grails-plugin-testing and grails-test library from test to provided. This helped to build the project, but it brought unwanted (but quite expected) side effects at runtime. After a request to the application, the code which serialize an object to JSON using GSON throws the following:
java.lang.ClassNotFoundException: org.springframework.mock.web.MockHttpServletRequest
at java.lang.Class.privateGetDeclaredMethods(Class.java:2436)
at java.lang.Class.getDeclaredMethods(Class.java:1793)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
at grails.plugin.gson.converters.GSON.render(GSON.groovy:57)
at grails.plugin.gson.api.ArtefactEnhancer$_enhanceControllers_closure1.doCall(ArtefactEnhancer.groovy:29)
...
I wonder if their is a way to only consider the GsonUnitTestMixin class just for tests.