Setting up Yanel in the Eclipse IDE

This document will get you started using Eclipse to develop/debug Yanel. To keep things simple and reliable, building and SVN access will be done outside of Eclipse. Also, it is assumed that you are using a unix-like shell for command line processing, if you are using the windows command line, replace the references to the shell scripts below with their aequivalent dos batch files (e.g. replace "build.sh" with "build.bat").

Depending on what you will be working on, you might need to import several projects into Eclipse. In this context, there are 3 types of projects: realms, resources, and Yanel itself.

Importing a realm

If you want to work on a realm that has a separate repository from the Yanel source, i.e. that is not one of the realms included with Yanel, follow these steps to import it as a project into Eclipse:

  1. Check out Yanel and the external realm, and add the realm to Yanel by following this example.
  2. Build an Eclipse project using the specific "eclipse" target with the realm's build file:
    {path/to/yanel/root}/build.sh -f {path/to/realm/root}/build.xml eclipse
  3. In Eclipse, select File -> Import, to open the Import dialog.
  4. Select General -> Existing Projects into Workspace, then click on Next.
  5. Check "Select root directory", click on Browse, and select the realm's root directory (i.e. where build.xml is located)
  6. Make sure the realm project is selected (should be the only one), "Copy projects into workspace" is not selected, and click on Finish.

The realm should now be visible as a project in the Package Explorer.

Importing resource types

If you want to work on a specific resource type that is either a resource type of Yanel, or one belonging to another realm, follow these steps to import it as a project into Eclipse:

  1. Follow point #1 above if you have not already done so.
  2. Build an Eclipse project using the specific "eclipse" target with the resource's build file:
    {path/to/yanel/root}/build.sh -f {path/to/realm/root}/build.xml eclipse
  3. In Eclipse, select File -> Import, to open the Import dialog.
  4. Select General -> Existing Projects into Workspace, then click on Next.
  5. Check "Select root directory", click on Browse, and select the realm's root directory (i.e. where build.xml is located)
  6. Make sure the realm project is selected (should be the only one), "Copy projects into workspace" is not selected, and click on Finish.

The realm should now be visible as a project in the Package Explorer.

Importing Yanel

  1. Check out and build Yanel as usual.
  2. Build an Eclipse project using the specific target "eclipse":
    {path/to/yanel/root}/build.sh eclipse
  3. In Eclipse, select File -> Import, to open the Import dialog.
  4. Select General -> Existing Projects into Workspace, then click on Next.
  5. Check "Select root directory", click on Browse, and select the Yanel root directory (i.e. where build.sh is located)
  6. Make sure the Yanel project is selected (should be the only one), "Copy projects into workspace" is not selected, and click on Finish.

The project "yanel" should now be visible in the Package Explorer.

Debugging

To start debugging with Eclipse, start Tomcat in debug mode:

{path/to/yanel/root}/local/apache-tomcat-5.5.20/bin/catalina.sh jpda start

 

 

 

 

 

Project setup
Create new Java Project in Eclipse workspace. Use the option "Create project from existing source".
BUILD
To build yanel, use ./build.sh in the console. Make sure Option "Build Automatically" is turned off in Eclipse. alternative: one can also use the "run external tools" to build inside eclipse. which is handy because you don't have to switch between shell and eclipse. Go to the menu Run -> External Tools -> Open External Tools Dialog... click "new Lanuch Configuration" to add a new launcher. In the main tab choose the build.xml of your yanel. (e.g. ${workspace_loc:/yanel-projects/src/build/build.xml}). Choose the target which you want to configure on the targets-tab. IMPORTANT: choose the target before you set the ant-home (see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=143008#c6). On the classpath tab add the ant shipped with yanel as ant-home.
CLASSPATH
Add libraries to classpath of the project. The libraries are located in $ECLIPSE_WORKSPACE$/yanel-trunk/local/apache-tomcat-5.5.20/webapps/yanel/WEB-INF/lib. Add all libraries except the ones starting with yanel-*.
CORRECT
Eclipse import source wizzard mixes up something with src/resources/testing-times/src. Remove this folder from build path and add src/resources/testing-times/src/java. Perform project cleanup.
DEBUG
Use the Eclipse Tomcat Lanucher (http://www.eclipsetotale.com/tomcatPlugin.html) which registers Tomcat process to Eclipse debugger.
To debug Resources of a project, set a breakpoint in a resource. Eclipse will not find the source of the resource automatically. After it fails the first time you can use the button displayed "attach source" and then attach the whole resource folder of a realm.

also set in the log4j.properties the ConsoleAppender insted of the RollingFileAppender

    log4j.appender.A1=org.apache.log4j.ConsoleAppender 
#log4j.appender.A1 = org.apache.log4j.RollingFileAppender
#log4j.appender.A1.File = /home/simon/src/yanel-projects/build/logs/log4j-cnode1.log
this way you can see the output of the logging in the eclipse console.
Other projects depending on Yanel
To develop projects depending on yanel, like "Yanel contributions", add yanel-trunk as project dependency to this project.
For Windows user:
The files should have LF as end character. Menu: Window -> Preferences -> General -> Workspace -> New text file line delimiter. Set to "Unix".


Your comments are much appreciated

Is the content of this page unclear or you think it could be improved? Please add a comment and we will try to improve it accordingly.