Reputation: 393
I have a lot of successful rest accesses in grails 2.x.x I simply coded
import grails.plugins.rest.client.*
import grails.util.Holders
import org.codehaus.groovy.grails.web.json.JSONObject
import org.codehaus.groovy.grails.web.json.JSONArray
and Classes JSONObject, JSONArray, RestBuilder, RestResponse where available for further use.
What are the corresponding imports in 4.0.1 and what jars resp. what lines in build.gradle are necessary?
Upvotes: 1
Views: 885
Reputation: 27200
What are the corresponding imports in 4.0.1 and what jars resp. what lines in build.gradle are necessary?
Grails 4 offers better options than to interact with the classes you asked about but to answer the question as asked...
org.grails.web.json.JSONObject
is in grails-web-common-4.0.1.jar
. Use import org.grails.web.json.JSONObject
.
org.grails.web.json.JSONArray
is in grails-web-common-4.0.1.jar
. Use import org.grails.web.json.JSONArray
.
grails.plugins.rest.client.RestBuilder
is in grails-datastore-rest-client-6.1.12.RELEASE.jar
. Use import grails.plugins.rest.client.RestBuilder
.
grails.plugins.rest.client.RestResponse
is in grails-datastore-rest-client-6.1.12.RELEASE.jar
. Use import grails.plugins.rest.client.RestResponse
.
Depending on what other dependencies you may have in your project those may or may not be pulled in transitively so you may not need to add them to your build.gradle
directly. The most likely scenario is you won't need to add anything to pull in grails-web-common-4.0.1.jar
but you probably will need to pull in grails-datastore-rest-client-6.1.12.RELEASE.jar
which can be done by adding the following to your build.gradle
:
compile "org.grails:grails-datastore-rest-client:6.1.12.RELEASE"
If you want to pull in grails-web-common
explicitly you could use the following:
compile "org.grails:grails-web-common:4.0.1"
If you are using the BOM correctly, you could simplify that with the following:
compile "org.grails:grails-web-common"
I hope that helps.
Upvotes: 1