PDE Build Compile Errors

July 10, 2009 | 3 min Read

Yesterday I spent the day working on examples of how PDE Build can be used to build OSGi bundles.  I was setting up builders, copying files from my workspace to my builder, and running builds.   Early in the morning I was faced with the follow:

The method disposeImageButtonImages(ImageButton) from the type ScaledWidgetFactory refers to the missing type ImageButton

Ok, a compile error, no big deal… the better part of a day later I finally had this solved.  Just so nobody ever has to deal with this particular error again, I thought I would post a small debugging tip you can use.  But first, some background on my day (after I saw the error):

  1. Ensure export from the UI works… yes!
  2. PDE/Build defines a variable called pluginPath that you can use to point at additional plugin locations.  Since the missing type  –ImageButton in my case – was in a pre-compiled bundle that exists in my target, I assumed this variable was set wrong.  I tried different separators, bundle ordering and directory locations (with and without spaces in the name). I even tried putting the bundle in my baseLocation.  No dice.
  3. You can debug Ant scripts using PDE/Build.  There are a few things that you must setup first, but after I did this I was able to debug the script and ensure that the “so called ‘missing’” bundle was indeed in my classpath.
  4. At this point something hit me – the compile errors is on the method call, not the import statement. That means that the compiler found the type on import, but not when the method was called…. strange!
  5. In this particular example we are using Import-Package as opposed to Require-Bundle. Maybe I found a bug… I changed all the code to use Require-Bundle… No Dice.
  6. Because build can be finicky, and and a typo can cause all sorts of problems, I started again… Same problem.
  7. Read a story to my daughter. (Best part of the day, by far)
  8. Back to work… This time, I started making small changes in different bundles, copying them over, and trying again… At one point, IT WORKED!
  9. Revert the changes… IT WORKS! – Note: That’s not good
  10. Start over, .. IT FAILS… make the same changes I did above.. IT FAILS!
  11. Curse
  12. Notice something.. when I copy the directories over, I am copying a bin/ directory that may (or may not) have fully built .class files.
  13. Delete the bin/ directory .. IT WORKS!

In fact, the problem will happen very infrequently.  It only happened because I was copying bundles from my workspace (not fetching them from CVS), and in some cases, the bundles were not fully built.

So, the lesson: If you get strange compile errors using PDE Build, try deleting the bundles bin/ directory.

Thanks goes out to Andrew Niefer who once again came through with a much better way off structuring my build.

Ian Bull

Ian Bull

Ian is an Eclipse committer and EclipseSource Distinguished Engineer with a passion for developer productivity.

He leads the J2V8 project and has served on several …