hello,
I am in the process of converting a project from ant to gradle (the complete source code is here: https://github.com/freeplane/freeplane/tree/Gradle_builds)
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’,
‘commons-io:commons-io:2.4’,
‘commons-codec:commons-codec:1.7’,
‘com.jgoodies:forms:1.2.1’,
‘com.github.insubstantial:flamingo:7.2.1’,
‘com.github.insubstantial:substance:7.2.1’,
‘com.github.insubstantial:substance-flamingo:7.2.1’,
‘com.github.insubstantial:substance-swingx:7.2.1’,
‘com.github.insubstantial:trident:7.2.1’
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/${it.name}” }
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:
http://www2.inf.fh-brs.de/~fnatte2s/freeplane-MANIFEST.MF
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’,
‘commons-io:commons-io:2.4’,
‘commons-codec:commons-codec:1.7’,
‘com.jgoodies:forms:1.2.1’,
[…]
I don’t like to do this since it’s redundant for a normal build.
Any hints are appreciated.
Thanks! Felix