Modular applications

Hello everybody,

I've just started studying Rails and I love it already for its simple, pragmatic spirit and the effectiveness and productivity that its approach brings. I'm thinking about building new applications on top of it and about rebuilding existing J2EE applications in Rails as well, but I've come across an architectural problem: we need to structure applications into functional modules, each comprising any artifacts needed for the additional functionality to work and interact flowlessly with the rest of the application. The modules need to have clean interfaces and dependencies between them, so that we can build and distribute different "variants" of the application (e.g. basic edition, management edition etc.). How would you proceed and/or what (existing or additional) tools would you use in order to do so? I'm really interested about both application structuring and build and deployment processes and tools advice. I'm interested in the development process as well, because it would be highly desirable for developers not to keep the whole application in their development workspace, but only the modules on which they actually work (and their dependencies of course).

Is the Rails Engines plugin the way to go? Would it satisfy all requirements?

Thanks in advance.

Fabio