Eclipse is the most popular IDE among Java developers.
Table of Contents
Download and Install
To make your project Eclipse-aware, perform the following steps:
- Read Development Environment for additional configuration information.
- Download Eclipse IDE for Java EE Developers.
- Install Eclipse into $TOOLS_HOME/eclipse.
- When starting Eclipse, set your workspace directory to
C:\Sourceon Windows and
- Install Maven Integration (m2e) by using "Install New Software" in Eclipse and searching for "Maven". You might also try the Maven Eclipse Plugin.
- Launch Eclipse and go to File > Import > Maven > Existing 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).
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.
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.