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).

7 comments:

  1. Hello, your post is very interesting, i follow all your steps and i can run the spoon using Ecplpse fine, but how do you debug the code of your plugin? because when you run it the plugins appear highlighted on the menu but only if it has its jar, so how is it possible for the spoon to use the code you have open in Eclipse instead of the jar file on the custom plugin folder?

    ReplyDelete
  2. Great guide!

    Also, download the PDI-CE Javadocs and attach them as external Javadocs to the Build Path dependencies.

    I have to say that having the PDI-CE sources are handy, because the Javadocs rarely say anything!! :-(

    ReplyDelete
  3. Don't miss the libext/JDBC jar files in the classpath, otherwise you can't properly run spoon inside eclipse, e.g. with accessing a database repository.

    ReplyDelete
  4. Can someone please tell me where can i find all the Jar files? I need to repackage Integrator.

    ReplyDelete
  5. sorry i have this error how i fix it

    java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3139 in java.library.path

    thanks

    ReplyDelete
  6. How to add the perform (step 8) there is no advanved option in same tab . How to add that data Integration folder location.

    ReplyDelete
  7. Hi Thanks really very usefull..

    ReplyDelete