Page tree
Skip to end of metadata
Go to start of metadata

Eclipse is the most popular IDE among Java developers.

Table of Contents

  1. Download and Install
  2. Integration with WTP
  3. Debugging
  4. Spring Support
  5. Tips and Tricks

Download and Install

To make your project Eclipse-aware, perform the following steps:

  1. Read Development Environment for additional configuration information.
  2. Download Eclipse IDE for Java EE Developers.
  3. Install Eclipse into $TOOLS_HOME/eclipse.
  4. When starting Eclipse, set your workspace directory to C:\Source on Windows and ~/dev on *nix.
  5. Install Maven Integration (m2e) by using "Install New Software" in Eclipse and searching for "Maven". You might also try the Maven Eclipse Plugin.
  6. Launch Eclipse and go to File > Import > MavenExisting Maven Projects. Select the root directory of your project, followed by the modules to import. Click Finish to complete the process.

After configuring Eclipse, you should be able to compile your project and run tests from within your IDE. For tests that rely on pre-existing data, you may have to periodically run mvn dbunit:operation to re-populate your database. You shouldn't need to worry about deploying from Eclipse because you can use the Jetty Plugin (mvn jetty:run) or Cargo (mvn cargo:run). 

Icon

The Eclipse project is likely to show multiple errors which are in fact not really errors. See APF-649

Debugging 

One of the nice things about AppFuse 2.0 is you shouldn't have to use Maven for the most part. It has much better IDE support now. You should be able to run most of your tests from within Eclipse. If you can run your tests, you should be able to debug them as well. If you write your tests so they don't depend on data already being in the database, you should be able to run your tests all day long. If you depend on pre-existing data, you may have to run mvn dbunit:operation every so often, or use DbUnit's Java API to pre-populate your database.

To debug your application while running it in Jetty , see Debugging with the Maven Jetty Plugin in Eclipse.

Spring Support 

Spring Tool Suite is an alternative IDE to Eclipse. You can also install STS as an Eclipse plugin. Below is an example graph created with Spring IDE.

Tips and Tricks

  • Ctrl+Shift+Rwill allow you to find any file within your project. It's a handy way to open files quickly without having to navigate through your source tree.
    • Ctrl+Shift+T does the same, but restricted to Java source files (Java view only).
  • Ctrl+Shift+E opens a dialog with the files you most recently open listed.

In order to clean up the project view in Eclipse, you can hide the files you don't need. First of all, make sure you're in the Java Perspective (Window → Open Perspective). Then click the little (down) arrow in the top right corner of the Package Explorer pane. Select Filters and check Libraries from external and Libraries from project. Click OK to continue.

Another useful Eclipse trick is to use abbreviated package names. It's a nice feature on projects where you're inflicted with super.long.package.name.syndrome. Go to Window -> Preferences -> Java -> Appearance. Check the "Compress all package names" checkbox and type "1." (no quotes) in the text field.