Issue with an embedded OSGi bundle


I used the Include-Resource to embed an OSGi bundle into another bundle like this:
Include-Resource: target/dependency/onecms.core-${onecms.core.version}.jar;lib:=true

Is it possible NOT to register services from an embedded OSGi bundle?

The problem I get is that all the services get registered twice: from the actual bundle installed in the OSGi container and the embedded one (dependency in another bundle).


I assume you must be referring to Declarative Services (DS) components (or CDI beans) being processed. By default, Bnd will examine all classes in the Bundle-Classpath (lib:=true) for components and creating the metadata to process them at runtime. You can use the -dsannotations or (-cdiannotations) instruction to control which classes Bnd will examine. So you can exclude any packages which you know are in the embedded jars.