views:

148

answers:

3

I am doing a few tutorials and done some demo applications in Grails.

Suppose I have more than one project made in Grails and I want to integrate all these projects in to a single application, how do I do it?

For eg: I have made a 'To do list' and 'on-line examination' and now I want to create a new application that would incorporate both these applications.

Thanks

A: 

Copy all the files from one project into the other's directory structure and merge all files that are present in both - shouldn't be too many since "convention over configuration" means you don't have many global configuration files.

A diff/merge tool that handles directory diffs will probably make this much easier.

Michael Borgwardt
Is there a better way of doing it? I mean with out changing the directory structure?
Omnipotent
You shouldn't change the directory structure at all (just merge it), since Grails depends on it. And that's also the reason why you can't have two directory trees side by side as part of the same Grails project.
Michael Borgwardt
+11  A: 

Another way to do this would be by re-packaging one (or both) of your projects as a plugin. That would allow you to keep them in separate code bases if you need to.

A plugin IS a regular Grails application (you can run it with grails run-app), so the switch over shouldn't be difficult.

Jean Barmash
good call on the plugin method - a plugin is not just something you provide to other apps. you can make plugins as part of your own app, and using plugins means that it is more modular, and thus reusable perhaps.
Chii
+1  A: 

The BEST way to create reusable modules in Grails is to package them as Grails plugins. As it was mentioned already, a Grails plugin IS a regular Grails web application (with a standard layout) with additional meta data, so it helps the GrailsPluginManager component to incorporate plugins into other applications.

I'd highly recommend the book which covers most of the aspects of the Grails plugin system pretty well. It even shows the example of how to wrap the 'regular' blogging app as a plugin and incorporate into another Grails application.

Dmitriy Kopylenko