Always put dependent JAR Files in separate bundles and describe the dependencies in your Manifest file.
Don't hide those JARs in your own bundle.
If a Bundle for your dependent JAR File already exists in one of the Bundle Repositories - then choose this.
Don't create your own bundles for existing ones.
- Does the bundle exist in the SpringSource Enterprise Bundle Repository ? SpringSource is my first choose, because all bundles and dependencies are described there in detail. A great thanks to the SpringSource Team for this great work.
- Does the bundle exist in the Eclipse Orbit Repository ? You can find an overview here.
- To be sure also search for the bundle at OSGI (look at OBR Bundle Repository).
- Only if all search results are negative, I'm creating my own bundle with help of PDE as descibed above. If its a common JAR - File used in many projects, then I create an entry into SpringSource JIRA "wishing" to have this bundle there. Some time ago I was looking for bundles of Drools Rule Engine, but nothing exists in any of the repositories. So I put an entry into SpringSource JIRA. Some days later: „Mission completed“ - if you're now looking for it you'll find per ex.: Drools Rules Engine Core.
If possible use Import-Package to resolve your dependencies.
Export only your "public" packages - no internal.
Use Require-Bundle only to resolve dependencies inside your own „universe“, not against common bundles.
Always version Require-Bundle, Import-Package und Export-Package.
If a bundle itself contains packages inside the bundle and exports them, never put these packages also into the Manifest as imported packages.
This can cause PDE to detect cycles and then some functionalities of PDE tooling don't run as expected.
Before deploying of a bundle as plug-in be sure the Package-Uses are re-calculated.
Wrong Package-Use entries for exported packages can stop PDE to export your Plug-In.
Rule 6:Avoid nesting JAR - Files - better use multiple bundles.
- PDE reports incorrect Package-Uses of org.ow2.easybeans.core if you try to export your bundle as deployable plug-in. Open MANIFEST.MF of org.ow2.easybeans.core bundle from workspace, tab Runtime - Exported Packages re-caclulate Uses. Save MANIFEST.MF and try again to export your bundle.
- Now PDE detects the cycles. Again open MANIFEST.MF, tab Dependencies, Dependency Analysis „Find unused Dependencies“ and remove all selected. Save MANIFEST.MF and try to export again.