treefrog
treefrog

Reputation: 1057

How does Embed-Dependency from maven-bundle-plugin work in these cases?

I am trying to understand how the following will work:

If I have a number of third party bundles that I want to embed transitively, in my bundle I would use Embed-Dependency with a * and specify as transitive true.

What happens to the bundle-activators that are specified in these dependent bundles ? How will these dependent bundle activators get triggered ? I am not seeing it triggered....

If it is expected that they won't be triggered at all then how will we get the funtionality from these bundle activators ?

Upvotes: 2

Views: 545

Answers (2)

Ka Pr
Ka Pr

Reputation: 85

Not that I WANT to embed them... but if I did- then the activators of the bundles would not be called. So is it fair to say that you should use embed-dependency only in case of jars and bundles without activators ?

One reason I could try to embed the bundles would have been to get running a quick poc system with all my dependencies specified without a dependency on the environment providing it.

Upvotes: 0

Neil Bartlett
Neil Bartlett

Reputation: 23958

A bundle activator will only be called by OSGi if it is named in the Bundle-Activator header of the bundle's MANIFEST.MF. The implementation class must be loadable by the bundle, so it can be in any JAR that appears in the Bundle-ClassPath.

If you merely embed a JAR and expect its activator to be called then you will be disappointed.

However, the fact that these JARs have activators at all suggests that they are already OSGi bundles, so why on earth would you want to embed them?

Upvotes: 2

Related Questions