The Perfect Eclipse Setup
This page contains step by step instructions on how to setup Eclipse and checkout the
MailArchiva Open Source Edition trunk. Follow these instructions carefully and you should be in a position to debug and compile the whole server system. I'm using Eclipse with
SuSE 10.3 X86_64, however, these instructions should also apply to other platforms (with minor modifications). Linux users will need to perform the majority of setup instructions as root. Tip: You can use the little command
sux to get root access with
X.
Download Eclipse
Your first task is to download the newest Eclipse version.
Eclipse Classic 3.3.1.1 is recommended. Don't worry about installing any additional features, as the needed ones will be installed later in this guide. After downloading the software, unpack the archive into a directory of your choice (I use the directory /opt/eclipse under Linux). For reasons explained below, It is a good idea to help Eclipse stretch out and use more memory. You do this by updating your eclipse.ini file as follows:
-showsplash
org.eclipse.platform
-vmargs
-Xms512m
-Xmx1024m
-XX:PermSize=128M
-XX:MaxPermSize=256M
-XX:+CMSPermGenSweepingEnabled
The above setup was used on a machine with 4GB of physical memory. If you don't have that much memory available, you could change the
-Xms512m and
-Xmx1024m parameters to values that are more suited to the constraints of your environment. The
-XX parameters are particularly useful when debugging Tomcat projects as the app server is plagued with a redeployment bug that causes the it to consume more memory than it would normally otherwise do. For the meantime, start Eclipse using aforementioned parameters. If you have problems later, you can always readjust them to better suit your machine environment. You can also write a start script that supplies these parameters directly:
#!/bin/bash
PATH=$PATH:./
ECLIPSE_HOME="/opt/eclipse"
$ECLIPSE_HOME/eclipse -vmargs -Duser.language=en -Dfile.encoding=utf-8 -Xms512m -Xmx1024m -XX:PermSize=256M -XX:MaxPermSize=512M -XX:+CMSPermGenSweepingEnabled
(This is for linux, put it in the file /usr/local/bin/eclipse, make it executable: chmod +x /usr/local/bin/eclipse)
Starting eclipse the first time
Start Eclipse (if you haven't already). Eclipse will ask you for it's workspace. Use an empty one to make sure everything will be installed correctly. If you haven't used Eclipse click
OK. If you have used it with the default workspace, use a different one now.
Installing the required features
Select
Help -> Software Updates -> Find and Install ... now this screen should appear:

Make sure you have selected
Search for new features to install and click
Next
Now select the
Europa Discovery Site
and click finish. If you were asked for a mirror, select the mirror of your choice or select "Automatically select mirrors".
Now open the
Europa Discovery Site tree and choose all of
Web and JEE Development. Afterwards, click on
Select Required.
Click
Next and accept the license terms, click
Next again. You'll see an overview of all the optional features you are going to install. Click
Next again. Now we are almost done! Click
Finish to download and install the features. This will take a few minutes/hours, depending on the speed of your connection.

.
After downloading you'll be asked to install with this screen:
Click
Install All to ensure that everything will be installed in the next step. After the installation is finished, you will need to restart Eclipse.
Subversion plugin installation
To get full access to the subversion-repository, it is recommended to install the subversion-plugin of your choice. I prefer the
subclipse-plugin.
The installation instruction is located here
http://subclipse.tigris.org/install.html.
After this step you can switch back to an unprivileged user. If you do so quit Eclipse, switch back, and start Eclipse again.
Setup the subversion repository
Now we need to setup the subversion repository to checkout the server trunk.
Open the subversion-perspective:
Right-click into the
SVN Repository window and create a new subversion-repository:
Put the repository location into the URL-field (
https://openmailarchiva.svn.sourceforge.net/svnroot/openmailarchiva) and click
Finish.
After collapsing the repository tree you should see this:
Checkout the MailArchiva-Server
Now it's time to checkout the server-source code. Right-click on
trunk and say
Checkout. After the checkout dialog appears just say
Finish.
Everything you need should be checked out to your workspace (including the tomcat server!). This may take some time.
Setup the Servlet-Container (Tomcat)
After everything is in your workspace now, we need to setup the tomcat-server. This should be the last step.
First switch to the
Java Perspetive (default), if you see the
Whats new welcome screen, just close it.
You should see this now:
Open the
Preferences dialog:
Go to the
Server -> Installed Runtimes and click
Add
Select
Apache -> Apache Tomcat v6.0.
--> Make sure "Also create new local server" is checked <--
and click
Next
Select the tomcat installation directory. The Tomcat server is located in your workspace under
Mail Archiva Server/setup/server. It must be the full path to the server installation dir, you cannot use the workspace relative path!
Click
Finish and quit the
Preferences dialog with
OK. That's it.
You should look around in your eclipse enviroment, there are a lot of new perspectives and views. here are the most useful ones:
- Perspectives
- Debug: ok no comment
- Java EE: here you can see the deployment descriptor
- Views
- Servers: Very useful for starting and stopping the tomcat server
All others should be clear.
Start a debug session
Ok and now the last step to debug the server. Right click on the
Mail Archiva Server project, say
Debug As -> Debug on Server
If you do this the first time another dialog pops up, just say
Always use this server when running this project and click
Finish.
The server should start and the
MailArchiva login page should open. You can debug everything: java-files and jsp-files too.
Good luck with your setup, hopes this helps.
--
TWikiGuest - 03 Jan 2008