Eclipse allows the use of multiple workspaces. It is not mandatory, but recommended that a separate workspace be used per Keel project. In earlier sections the Keel project directory was introduced. The Eclipse workspace should be the parent of $KEEL_PROJ. In fact, it makes things easier if this thought is applied when creating the Keel project for the first time, the directory should be chosen as <some-path>/<myworkspace>/<myproject>.
Eclipse can be started to use a specific workspace as follows:
eclipse -data <some-path>/<myworkspace>
A window-manager/desktop shortcut with a similar command as above makes starting Eclipse much simpler.
Since Keel works with Java-1.4, Eclipse must be setup to conform. As shown in Figure 3.1, “Eclipse Preferences”, select "Preferences" from Eclipse's "Window" menu. In the Preferences dialig, navigate to Java->Compiler-Compliance and Classfiles. As shown in Figure 3.2, “Java-1.4 Preferences”, set the comliance level to 1.4. Uncheck "Use default compliance settings", and set the other selections to "1.4", "1.4" and "Error". Click OK.
The first thing that needs to happen is for us to create a project. As shown in Figure 3.3, “Creating a New Project”, create a new project from Eclipse's File->New->Project in Eclipse:
In the new project dialog, select "Java Project" as shown in Figure 3.4, “Creating a New Java Project” and click the "Next >" button. In the resulting dialog, type the name of the project (mykeel, in this case) as shown in Figure 3.5, “Assigning a Name to the New Project” and click "Next >".
In the Java Settings dialog, select the Source tab. Select the only source folder defined by default, and click on the "Remove" button to delete it (since the project itself will never have any source associated with it).
Now navigate to the "Libraries" tab, and click on the "Add Library ..." button. As shown in Figure 3.6, “Adding User Libraries”, select "User Library" in the "Add Library" dialog, and click on "Next >".
In the "User Library" dialog, click on "User Libraries...", and in the resulting "User Libraries" dialog click on "New...". As shown in Figure 3.7, “Define Keel Libraries”, a prompt for the user lirary name pops up. Type "KEEL_SERVER" and click on OK. Click on the "New..." button again, but this time define a "KEEL_CLIENT" library.
Back in the "User Libraries" dialog, select the just added "KEEL_SERVER" lib and select "Add JARs...". In the dialog that opens up, as shown in Figure 3.8, “Add Keel Server JARs”, navigate to the Keel server side lib directory. In general, this will be a path in your project that is referred to in the ant.properties file with the "keel.server.path". For webapps deploys, this path will be $KEEL_PROJ/webapp/WEB-INF/keel/server/lib. Select all the JARs in this directory and click on "Open".
Again in the "User Libraries" dialog, select the "KEEL_CLIENT" library and select "Add JARs..." again. This time, as shown in Figure 3.9, “Add Keel Client JARs”, navigate to $KEEL_PROJ/webapp/WEB-INF/lib, select all the JARs and click "Open".
Make sure that both the KEEL_SERVER and KEEL_CLIENT checkboxes are selected and click OK, as shown in Figure 3.10, “Selected User Libraries”.
Back in the "Java Settings" dialog, as in Figure 3.11, “Finishing Project Dialog”, click on the "Finish" button.
Your Keel project should now be setup, and look like the project in Figure 3.12, “New Keel Project”.
For every user application or service module that is added to the project, the module's source path must be defined in Eclipse, as well s an output directory for the compiled classes. Select the Keel project, "mykeel" in our example, and right-click the mouse to get to the "Properties" menu item, as shown in Figure 3.13, “Keel Project Properties”.
In the Source tab of the properties dialog, click on the "Add Folder..." button and navigate to project's source directories. In the example shown in Figure 3.14, “Keel Module Source”, we navigated to $KEEL_PROJ/app-hoj/src/ and clicked the checkboxes next to the java and test folders.
As shown in Figure 3.15, “Keel Module Source”, define the output folder of each source directory to be the "build/classes" directory within that module.
If you want to navigate source for Keel internals, then expand the KEEL_SERVER and/or the KEEL_CLIENT and navigate to the JAR of interest and right-click on it to alter properties. As shown in the example in Figure 3.16, “Keel JAR Properties”, we will attach source to the "keel-core" module.
Click "External Folder...", navigate to the Keel distribution, $KEEL_HOME, and find the src/java directory in the keel-core (or, other Keel module, as appropriate), as shown in Figure 3.17, “Keel JAR Source”.
To setup Eclipse to debug Keel, a debug launch configuration must be setup. In the Java perspective, make sure the Keel project is selected. Click the "Debug.." menu item under the little "bug" icon in Eclipse, as shown in Figure 3.18, “Setup Launch Configuration”.
Select "Remote Java Application" and click "New". In the Connect tab, as shown in Figure 3.19, “Setup Launch Configuration”, make sure that the correct Keel project is listed in the "Project:" field (important when you have multiple projects in the workspace). In the Common tab, as shown in Figure 3.20, “Show Launch Config in Debug Menu”, make sure the the checkbox next to "Debug" is selected. Click "Apply", then "Close".
Now you can start Tomcat, or the Keel server when using the standalone Keel server deployment, for remote JPDA debugging. For instance, you can start Tomcat as follows (in Unix):
cd $KEEL_HOME/keel-build/deploy/jakarta-tomcat-5.0.19 bin/catalina.sh jpda start
or, in Windows as:
cd %KEEL_HOME%\keel-build\deploy\jakarta-tomcat-5.0.19 bin\catalina.bat jpda start
Once Tomcat starts up, you can connect the Eclipse debugger by using the Keel launch configuration previosuly defined, as shown in Figure 3.21, “Launch Debug Session”. If everything goes correctly, you should see something similar to Figure 3.19, “Setup Launch Configuration”.