Chapter 5. Existing Building Blocks

Sometimes you have an existing project or database. This chapter covers how to make Spring Roo work with it.

5.1. Existing Projects

If you have an existing project that you'd like to use with Roo, we recommend that you follow these steps:

  1. Decide whether your project files are easier to migrate to a new Roo project or it's easier to amend your current project into a Roo project. Both approaches are valid. The following steps reflect migrating your current project into a Roo project.

  2. Convert the project to use Maven. Ensure you use the correct Maven directory layouts.

  3. Move your Spring configuration and other files to the same directories as used by Roo. Start a new Roo-based project if you're unsure where these files are typically stored.

  4. Add the Roo annotations JAR and Maven AspectJ plugin to your POM. Use the same syntax as a new Roo-based project would use.

  5. Load Roo on your project and verify it does not report any errors. Resolve any errors before continuing.

  6. Add a test @RooToString annotation to one of your existing classes. Verify the ITD is created and can be used within your IDE (if you're using an IDE). Check the new toString() method is used.

  7. Start incrementally using the simpler Roo add-ons like toString support and JavaBeans. When you're confident, move onto other Roo commands and add-ons.

If you encounter any difficulty, we recommend you consult the Roo Resources section of the reference guide for help.

5.2. Existing Databases

Many organisations have existing databases that they'd like to use with Roo.

A significant new feature added to Spring Roo 1.1 was support for incremental database reverse engineering. This feature is robust and comprehensive, and allows you to reverse engineer an existing database in a single command. The single command doesn't even ask you any questions as it operates, and it gracefully handles changes to your schema over time.

We recommend that you consult the incremental database reverse engineering chapter if you'd like to work with an existing relational database.