10.10.1 Getting Started

If you are using the REST or AngularJS profiles then the JSON views plugin will already be included and you can skip the remainder of this section. Otherwise you will need to modify your build.gradle to include the necessary plugin to activate JSON views:

  1. compile 'org.grails.plugins:views-json:1.0.0' // or whatever is the latest version
The source code repository for JSON views can be found on Github if you are looking for more documentation and contributions

In order to compile JSON views for production deployment you should also activate the Gradle plugin by first modifying the buildscript block:

  1. buildscript {
  2. ...
  3. dependencies {
  4. ...
  5. classpath "org.grails.plugins:views-gradle:1.0.0"
  6. }
  7. }

Then apply the org.grails.plugins.views-json Gradle plugin after any Grails core gradle plugins:

  1. ...
  2. apply plugin: "org.grails.grails-web"
  3. apply plugin: "org.grails.plugins.views-json"

This will add a compileGsonViews task to Gradle, which is invoked prior to creating the production JAR or WAR file.