[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] Fragments: exported package not found in client bundle

Context: eclipse 3.2.2

Here's the simple fragment experiment that I performed.

I created 3 bundles.

(1) experiment.host

Bundle-SymbolicName: experiment.host
Import-Package: org.osgi.framework;version="1.3.0"
Export-Package: experiment.host;version="1.0.0"

(2) experiment.frag

Bundle-SymbolicName: experiment.frag
Fragment-Host: experiment.host;version="1.0.0"
Export-Package: experiment.frag;version="3.3.2"

(3) experiment.main (the bundle accessing package "experiment.frag")

Bundle-SymbolicName: experiment.main
Import-Package: experiment.frag;version="3.3.2",


a) In the eclipse workspace, I cannot import package "experiment.faq" inside
the editor of file "experiment/main/internal/Activator.java". The editor
flags the package with error:

  The import experiment.faq.* cannot be resolved.

b) If I start 3 bundles in an equinox launcher, the fragment is attached to
the host correctly.

2 ACTIVE      experiment.host_1.0.0
3 RESOLVED    experiment.main_1.0.0
4 RESOLVED    experiment.frag_1.0.0

However starting bundle 3 will throw a "java.lang.Error": Unresolved
compilation problems:
 The import experiment.frag cannot be resolved

c) If I attach bundle "experiment.fraq" to "system.bundle" instead, then
everything wires up correctly.

Bundle-SymbolicName: experiment.frag
Fragment-Host: system.bundle
Export-Package: experiment.frag;version="3.3.2"

My understanding of fragment bundles is that they allow the contribution of
new packages OR the contribution of new artifacts to the same package in the
host bundle (split package scenario).
Why is my experiment failing ?