Gradle-OSGi question: Export local third-party dependencies


I am in the process of converting a project from ant to gradle (the complete source code is here:

The project consists of a main project (:freeplane) and several plugins (:freeplane_plugin_*). With the ant build system, we pulled some dependencies (commons-lang, commons-io, jgoodies-forms, …) in the :freeplane project, here is the gradle block for that:

dependencies {

compile project(’:JOrtho_0.4_freeplane’)

compile ‘commons-lang:commons-lang:2.6’,









compile files(’./lib/SimplyHTML.jar’,’./lib/idw-gpl.jar’)

} exported these in freeplane/META-INF/MANIFEST.MF and imported them in the plugins (freeplane_plugin_*/META-INF/MANIFEST.MF).

So, I configured the gradle OSGi plugin like this (freeplane/build.gradle):

jar {

manifest {

name = pluginid

symbolicName = pluginid

ext.deps = configurations.runtime.files.collect { “lib/${}” }

ext.deps.add(0, “lib/freeplaneosgi-” + project.version + “.jar”)

ext.deps.add(0, “lib/freeplaneeditor-” + project.version + “.jar”)

ext.deps.add(0, “lib/freeplaneviewer-” + project.version + “.jar”)

attributes ‘Class-Path’ : ext.deps.join(’, ')

attributes ‘Bundle-ClassPath’: ‘., ’ + ext.deps.join(’, ')

instruction ‘Bundle-Vendor’, ‘Freeplane Project’

instruction ‘Import-Package’, ‘org.osgi.framework,org.osgi.service.url;version=“1.0.0”’

instruction ‘Export-Package’, ‘*;-noimport:=true’

instruction ‘Bundle-Activator’, ‘org.freeplane.main.osgi.Activator’

instruction ‘Bundle-RequiredExecutionEnvironment’, ‘J2SE-1.6’



But, despite the "Export-Package: " header, local dependencies such as org.apache.commons.lang. are not exported, please see “Export-Package” here:

Is exporting local third-party dependencies generally not supported by gradle-osgi/bnd? If yes, shall I duplicate all local third-party dependencies in all plugins:

compile ‘commons-lang:commons-lang:2.6’,





I don’t like to do this since it’s redundant for a normal build.

Any hints are appreciated.

Thanks! Felix

hi, The problem with duplicating third-party dependencies in the core project and its plugin and its plugin project, which could easily be accomplished by:


is disk usage: ~20Mb vs. ~100Mb. => Is there another solution to export commons-lang etc. in :freeplane and importing it in :freeplane_plugin_* ?

Many thanks, any hint is appreciated! Felix

There is a workaround: Use attributes instead of instruction for ‘Export-Package’ (which bypasses bnd).