Manifest Embed-Dependency not actually embedding dependencies

I’m having an issue where my jar’s dependencies are not being embedded into the OSGi bundle I’m creating. Here’s my jar closure: ‘’’ jar {

manifest {

name = ‘my-framework-jar’

instruction “Export-Package”, “my.package.spock.*”

instruction “Embed-Dependency”, “*;inline=false”

} } ‘’’

And here’s the resulting MANIFEST.MF: ‘’’ Manifest-Version: 1.0 Export-Package: my.package.spock;uses:

="my.package.spock.report,geb,geb.spo

ck,groovy.lang,org.junit.rules,org.spockframework.lang,org.spockframe

work.mock,org.spockframework.runtime.model,spock.lang",my.package.spo

ck.report;uses:="groovy.lang,org.spoc

kframework.runtime,org.spockframework.runtime.extension,org.spockfram

ework.runtime.model" Private-Package: my.package.ads,my.package.akamai, (etc) Bundle-Version: 1.0.0.SNAPSHOT Tool: Bnd-2.1.0.20130426-122213 Bundle-Name: my-framework-jar Bnd-LastModified: 1398284612686 Created-By: 1.7.0_40 (Oracle Corporation) Bundle-ManifestVersion: 2 Embed-Dependency: *;inline=false Bundle-SymbolicName: my.package.my-framework-jar Import-Package: com.fasterxml.jackson.databind;version="[2.3,3)",com.j

ayway.restassured,com.jayway.restassured.response,geb,geb.content,geb

.js,geb.navigator,geb.report,geb.spock,geb.textmatching,geb.transform

,geb.transform.implicitassertions,groovy.lang;version="[2.0,3)",net.l

ightbody.bmp.core.har,org.apache.commons.codec.binary;version="[1.6,2

)",org.apache.commons.lang3;version="[3.3,4)",org.apache.http,org.apa

che.http.client.methods,org.apache.http.client.utils,org.apache.http.

entity,org.apache.http.impl.client,org.apache.http.message,org.apache

.http.util,org.codehaus.groovy.reflection;version="[2.0,3)",org.codeh

aus.groovy.runtime;version="[2.0,3)",org.codehaus.groovy.runtime.call

site;version="[2.0,3)",org.codehaus.groovy.runtime.powerassert;versio

n="[2.0,3)",org.codehaus.groovy.runtime.typehandling;version="[2.0,3)

“,org.codehaus.groovy.runtime.wrappers;version=”[2.0,3)",org.json.sim

ple;version="[1.1,2)",org.junit,org.junit.rules,org.junit.runners.mod

el,org.openqa.selenium,org.openqa.selenium.interactions,org.openqa.se

lenium.remote,org.spockframework.lang,org.spockframework.mock,org.spo

ckframework.runtime,org.spockframework.runtime.extension,org.spockfra

mework.runtime.model,spock.lang ‘’’

I get the error: org.osgi.framework.BundleException: Unresolved constraint in bundle [16]: Unable to resolve 16.0: missing requirement [16.0] package; (&(package=com.fasterxml.jackson.databind)(version>=2.3.0)(!(version>=3.0.0)))

And I do have jackson in my dependencies: compile “com.fasterxml.jackson.core:jackson-databind:2.3.2”

So, I guess the osgi plugin just creates the manifest, and I have to actually build the bundle myself. Are there any examples of how to do this?

For some reason, using ‘Bundle-ClassPath’ removes my ‘Export-Package’ statement from the resulting MANIFEST.MF:

apply plugin: ‘osgi’

jar {

into(‘lib’) {

from configurations.compile

}

manifest {

name = ‘my-framework-jar’

instruction “Export-Package”, “my.package.spock.*”

instruction “Embed-Dependency”, “*;scope=compile|runtime;inline=false;”

instruction “Bundle-ClassPath”, “lib”

}

}

MANIFEST.MF

Manifest-Version: 1.0

Bundle-ClassPath: lib

Bundle-Version: 1.0.0.SNAPSHOT

Tool: Bnd-2.1.0.20130426-122213

Bundle-Name: my-framework-jar

Bnd-LastModified: 1398368295729

Created-By: 1.7.0_40 (Oracle Corporation)

Bundle-ManifestVersion: 2

Embed-Dependency: *;scope=compile|runtime;inline=false;

Bundle-SymbolicName: my.package.my-framework-jar

A little late to answer this now, but Embed-Dependency is a Apache Felix Maven Bundle plugin instruction and is not used by bndlib (which is the actual library that processes the instructions).

1 Like