A Grails plugin is (or should be) a self-contained bundle of functionality that can be installed into a Grails application. When a Grails plugin is installed, it can do any of the following:
- define additional Spring beans
- modify the generated
web.xml
- add new methods to the application's artefacts (controllers, domain classes, services, etc.)
- provide new tag libraries
- make additional resources and classes available to the application
- provide new Grails commands
For example, when you install the JQuery plugin
- the JQuery JavaScript files are added to the application
- a new Grails tag
<jq:jquery>
is added to the application
- a new Grails command
grails install-plugin jquery
is added to the application
When you install a Grails plugin, that plugin's functionality is made available to the installing application. However, the plugin itself is not actually copied into the application, only the plugin name and version is added to the application's application.properties
file. The plugin itself is downloaded to $HOME/.grails
and the application loads it from there.
The structure of a Grails plugin project is identical to that of a Grails application, with the exception of a configuration file (known as a plugin descriptor) that is included in a plugin's root directory.