I am a big fan of both, OSGi and Eclipse RCP. In terms of flexible modular architecture I prefer to use “Import-Package” rather than “Require-Bundle”. However, probably due to historical reasons, PDE supports “Require-Bundle” much better than “Import-Package”. And, in the current Eclipse 3.3 platform, split packages are used (I guess mostly for compatibility reasons). With my current RCP demo application, I have the following problem with switching to “Import-Package”: After putting my target platform in the list of “Automated Management of Dependencies” (Why is that not the default?, probably I file a feature request) and letting PDE compute the dependencies using “Import-Package”, my application does not run anymore.
I get the error:
java.lang.NoClassDefFoundError: org/eclipse/ui/progress/IProgressService.
Who has an advice or a best practice how generally to proceed here?
Please file a bug with a reproducible test case against PDE Kai.
Also, it’s not that PDE necessarily favors Require-Bundle. We have done quite a bit in the last two releases that enhance the experience of using Import-Package. The problem is that the Eclipse platform, for legacy and convenience reasons uses Require-Bundle. I’m a staunch supporter of Import-Package as it makes live easier when it comes to refactoring in the future.
You have inspired me to blog about Import-Package versus Require-Bundle though. Stay tuned for a real world scenario…