Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Using Maven, it is very easy to create an OSGi bundle from any library. However, I think the same result can be created with other mechanisms, too. The Maven solution helped me understand how it works.</p> <p>Creating the bundle is done by creating a project which has the library as a dependency and then packaging the project using the <a href="http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html" rel="noreferrer">maven-bundle-plugin</a> from the <a href="http://felix.apache.org/site/index.html" rel="noreferrer">Apache Felix project</a> and specifying the library packages with the <code>Export-Package</code> instruction. I used this to share Google Protocol Buffers between bundles inside an OSGi container:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;project&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;com.example.lib&lt;/groupId&gt; &lt;artifactId&gt;protobuf-dist&lt;/artifactId&gt; &lt;version&gt;2.1.0&lt;/version&gt; &lt;name&gt;Google Protocol Buffers OSGi Distribution&lt;/name&gt; &lt;packaging&gt;bundle&lt;/packaging&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;com.google.protobuf&lt;/groupId&gt; &lt;artifactId&gt;protobuf-java&lt;/artifactId&gt; &lt;version&gt;2.1.0&lt;/version&gt; &lt;scope&gt;compile&lt;/scope&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.felix&lt;/groupId&gt; &lt;artifactId&gt;maven-bundle-plugin&lt;/artifactId&gt; &lt;extensions&gt;true&lt;/extensions&gt; &lt;configuration&gt; &lt;instructions&gt; &lt;Export-Package&gt;com.google.protobuf&lt;/Export-Package&gt; &lt;/instructions&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/project&gt; </code></pre> <p>If you want all transitive dependencies rolled into the bundle, too, use the <code>bundleall</code> goal of the plugin.</p> <p>The plugin recognizes and honours existing OSGi manifests in the dependency.</p> <p>You can also use the bundle plugin to just create the manifest and tell the <code>jar</code> packaging plugin (or the <code>jar-with-dependencies</code> builtin assembly) to use that manifest via the archive section. The plugin's page linked above shows how to do that.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload