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:
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 theeclipse:eclipse
Maven goal of the Maven Eclipse plugin, shown as follows:roo> perform command --mavenCommand eclipse:eclipse
To create IntelliJ IDEA specific project files, use the
perform command
to execute theidea: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