Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extending functionality of Grails Plugin

I would like to know, if it is possible and if there is a generic way to extend the functionality of a grails plugin.

I recently installed the commentable plugin, but need to do some modifications to it. Since the code is not stored together with the project (but in the user directory) if I modify it, after the plugin is updated (or the project at some other machine installed) these changes are lost.

Does someone have any idea?

Thanks, Nicolas

like image 256
Nicolas Avatar asked Mar 15 '11 18:03

Nicolas


2 Answers

If you want to override an artifact (e.g. a domain class) create one with the same name in your project. Plugins are compiled separately from the application classes and their artifacts are registered first, so if there's an artifact in the main app it will replace the plugin's. Just be sure to use the same package for domain classes, although this isn't required for controllers or services.

like image 191
Burt Beckwith Avatar answered Oct 04 '22 01:10

Burt Beckwith


If you want to modify the plugin completely, you may try to change and then recompile the plugin, and build it into a zip-file with different name.

Then you can install the customized-plugin from source code. You may refer to the question here.

like image 37
Hoàng Long Avatar answered Oct 04 '22 00:10

Hoàng Long