Book Image

Spring Roo 1.1 Cookbook

Book Image

Spring Roo 1.1 Cookbook

Overview of this book

Spring Roo is an easy-to-use productivity tool for rapidly developing Java enterprise applications using well-recognized frameworks such as Spring, Hibernate, AspectJ, Spring Web Flow, Spring Security, GWT, and so on. Spring Roo takes care of creating maven-enabled projects, enterprise application architecture based on your choice of technologies, unit/integration tests based on your choice of testing framework, and so on. The bottom line is that if you're using Spring, then you must consider using Spring Roo for increased productivity. Spring Roo 1.1 Cookbook brings together a collection of recipes that demonstrate how the Spring Roo developer tool simplifies rapidly developing enterprise applications using standard technologies/frameworks such as JPA, GWT, Spring, Flex, Spring Web Flow, Spring Security, and so on. It introduces readers to developing enterprise applications for the real world using Spring Roo tool. The book starts off with basic recipes to make readers comfortable with using Spring Roo tool. As the book progresses, readers are introduced to more sophisticated features supported by Spring Roo in the context of a Flight Booking application. In a step-by-step by fashion, each recipe shows how a particular activity is performed, what Spring Roo does when a command is executed, and why it is important in the context of the application being developed. Initially, you make a quick start with using Spring Roo through some simple recipes. Then you learn how Spring Roo simplifies creating the persistence layer of an enterprise application using JPA. You are introduced to the various roo commands to create JPA entities, create relationships between JPA entities, create integration tests using Spring TestContext framework, and so on. Following this, the book shows you how Spring Roo simplifies creating the web layer of an enterprise application using Spring Web MVC, Spring Web Flow, and how to create selenium tests for controller objects. Subsequently, we focus on using Spring-BlazeDS, GWT, JSON, and so on. Spring Roo commands that are used to incorporate e-mail/messaging features into an enterprise application are demonstrated next. Finally, we wrap it up with some miscellaneous recipes that show how to extend Spring Roo via add-ons, incorporate security, create cloud-ready applications, remove Spring Roo from your enterprise application, and so on.
Table of Contents (14 chapters)
Spring Roo 1.1 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Importing a Roo project into Eclipse or IntelliJ IDEA IDE


As explained in the Setting up Roo recipe, you can either use STS or Eclipse with STS components installed to work with Roo projects. Alternatively, you can create necessary project files to import the Roo project into Eclipse or IntelliJ IDEA IDE (for working directly with Java sources and configuration files) and run the Spring Roo shell separately in standalone mode to execute Roo commands.

In this recipe, we look at how you can import a Roo project into Eclipse or IntelliJ IDEA by executing commands provided by Spring Roo.

Getting ready

Start the Roo shell from the C:\roo-cookbook\ch01-recipe directory, which contains the flight-app Roo project.

How to do it...

To import the Roo project into Eclipse or IntelliJ IDEA follow the given steps:

  1. To create Eclipse-specific project files, execute the perform eclipse command from the Roo shell, shown as follows:

    roo> perform eclipse
    

    Alternatively, you can use the perform command to execute the eclipse:eclipse Maven goal of the Maven Eclipse plugin, shown as follows:

    roo> perform command --mavenCommand eclipse:eclipse
    
  2. To create IntelliJ IDEA specific project files, use the perform command to execute the idea:idea Maven goal of the Maven IDEA plugin, shown as follows:

    roo> perform command --mavenCommand idea:idea
    

How it works...

The perform eclipse and perform command commands are processed by the Maven add-on of Spring Roo. The perform eclipse command generates Eclipse IDE specific configuration files, such as .project and .classpath files. Behind the scenes, the perform eclipse command executes the eclipse:eclipse goal of the Maven eclipse plugin.

The perform command is used to execute a Maven command. It accepts a single mandatory argument, mavenCommand , which identifies the Maven goal to execute.

Note

Maven IDEA and Eclipse plugins are configured in the pom.xml file by Spring Roo at the project creation time; you don't need to add them to your Roo project to use the commands shown in this recipe.

There's more...

If you are using any IDE other than STS, then ensure that you install AJDT (AspectJ Development Tools), as it gives better development experience when working with projects that make use of AspectJ aspects. For instance, when you open a Java source file in Eclipse IDE (that has AJDT installed), the Cross Reference tab shows the various AspectJ declarations that apply to the selected Java source file, and you can select these declarations to open the corresponding AspectJ ITD files.

See also

  • Refer to the Setting up Roo recipe to know how to use STS or Eclipse (with STS components) for developing with Spring Roo

  • Refer to the Removing Roo-specific details from your project recipe in Chapter 7, Developing Add-ons and Removing Roo from Projects to see how you can convert your Roo project into a normal Java project