Friday, August 14, 2009

Develop/Debug Kettle Plugin In Eclipse

I started to develop some custom kettle plugin a few weeks but did not find a good documentation on how to debug plugin code in Eclipse. All the references point to a solution which requires loading all the kettle source code. Although this will work, it is not ideal since it is neither necessary nor convenient to load all the source code.

After trying it a couple of times, I have found a way to run kettle plugin in Eclipse without loading all the sources. Here are steps:

  1. Add the kettle-engine.jar, kettle-core.jar, kettle-ui.jar and kettle-db.jar in the build path
  2. Copy the plugin folder under Kettle installation into the Eclipse project.
  3. Create the corresponding plugin folder for your custom plug in and create plugin.xml
  4. Open the Run Configurations window
  5. Create a new Java Application
  6. Put the project name in project field and "org.pentaho.di.ui.spoon.Spoon" into the main class (Alternatively, you can search this class by clicking on "Search".
  7. In the classpath tab, add all the jar files in the data-integration/libext, data-integration/libext/jfree, data-integration/libext/pentaho, data-integration/libext/spring, data-integration/libext/common, data-integration/libswt, data-integration/libswt/win32 (if linux, data-integration/libswt/linux) folders in kettle installation to "user entries"
  8. In the same tab, click on advanced, select "Add External Folder". Select the installation folder (data-integration) and add to the user entries.
  9. Now you can run the application and should be able to see the Spoon running in Eclipse
You can set the debugging points and run in debug mode as well. In case you get any class not found exception, just try to find the jar file and add it to the classpath in run configurations (see step 6).