Best practice for modular Big Grails application?

The Grails application I'm working on is getting quite large, and it would be nice to reorganize it into several modules , so we don’t need to translate all this every time.

What is the best practice for splitting a Grails application into multiple modules? In particular, I would like to create a package of domain classes + related services and use it in the application as a module. Is it possible? Is it possible to do this with plugins ?

+7
design-patterns module plugins grails
source share
3 answers

what plugins are for. In the case of splitting a large application into several modules, using the "built-in plug-in" function is extremely useful. Just add

grails.plugin.location."<plugin-name>" = "<path to plugin dir>" 

into your grails-app/conf/BuildConfig.groovy . In doing so, you no longer need to run package-plugin and install-plugin after each modification inside the plugin.

For more information on using plugins, see the Grails reference documents or one of the available books: The Ultimate Grails Guide or Grails in Action. Both of them are absolutely valuable.

+8
source share

Grails plugins are a good packaging mechanism for reusing code / design / schema in applications or for clarifying ownership of several authors (which seems likely for a large application), but I do not think that they will save you in terms of deployment pain - at the end of course, the code is still present in the application, and the application should still configure plugins, etc.

Yes, you will save a little time due to caching the plugin for deployment purposes, but you will pay it with additional difficulties in the code, testing and version control of the plugins themselves.

However, I think that creating the domain + services plugin is a good module for reuse - we just did it, but it is more painful than helping with deployment problems.

IMO, the "best practice" for a large Grails application is to think about splitting the application into smaller applications using communication either through a database, or using memcache, or through some form of messaging - a lot of clean "no" shift everything this and strives for better scalability. Use plugins in every application where you want to use code or circuit reuse or circuitry and get enough reuse to justify the various overheads.

+3
source share

Consistent, plugins are an accepted way to do this. This will help you manage your code dependency graph and divide your application into sections that are easier to test and understand on your own. However, plugins are still designed to be combined into a single application during deployment. I am not sure which template you are looking for deployment.

0
source share

All Articles