Custom plug-in builds in Eclipse

Just had an interesting issue where I needed to make sure my Eclipse plug-in had the latest version of a jar-file I build in another Java project. Normally including a jar-file in a plug-in project is easy enough but when doing that you’re normally using a static jar-file that doesn’t change. I needed my plug-in to use the latest jar from the other Java project whenever the plug-in was built. Hmmm….

After some searching around and some hints via Twitter I found the solution and it was very easy as Eclipse already include the plumbing for this (from Eclipse 3.2). The solution was to contribute custom build steps to the build.xml that the PDE in Eclipse auto-generates. It’s way easier than it sounds.

The only changes I needed to make to my plug-in project was to:

  • Add “customBuildCallbacks=customBuildCallbacks.xml” to the
  • Add a customBuildCallbacks.xml Ant file to my plug-in project (the one that needed the newest jar) with a single target called “”
  • Write “code” for the target that replaces the jar-file in my plug-in project with the one from my Java project
  • Build the plug-in via my update site

For full details refer to Plug-in Development Environment Guide/Tasks/PDE Build Advanced Topics/Feature and Plug-in custom build steps in the online help.