Grails Jquery-ui plugin configuration

grails, grails-plugin

Solution

First you need to install the plugin, so in your BuildConfig.groovy

plugins {
  ...
  compile ":jquery-ui:1.8.24"
  ...
}

Use `grails compile --refresh-dependencies` and see if the console output the download of the plugin. If you are using STS, you can go in `right click > grails tools > refresh dependencies`

After that, you can add `<r:require module="jquery-ui"/>` before the `<r:layoutResources/>`

A usefull tip is the change of the jquery ui theme, you can configure this in your `ApplicationResources.groovy`

modules = {
    overrides {
        'jquery-theme' {
            resource id:'theme', url:'/css/ui/jquery-ui-1.8.21.custom.css'
        }
    }
}

In this example i have one css located in `web-app/css/ui/`.

Another tip is that you can force your modules to depend on jquery-ui:

modules = {
  mymodule {
    dependsOn 'jquery-ui'
    resource url: '/js/my.js'
  }
}

So if you add the resource `mymodule` to your GSP, the `jquery-ui` will be loaded too.

Problem

Trying to use the Jquery-UI plugin from http://grails.org/plugin/jquery-ui but apparently the documentations is not correct when discuss using the plugin with resources framework as following the instructions leads to an error: ``` Error processing GroovyPageView: Error executing tag <r:layoutResources>: No module found with name [jquery-ui] ``` Apparently the same problem is known around, but was not able to find a solution on the net (example: some discussion here and some other discussions with no solution or hints to a solution). Did anyone managed to successfully configure jquery-ui in grails with the resource framework?

Original source