Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [pde-dev] Common third-party dependencies exported for usage in other bundles

Felix Natter <fnatter@xxxxxxx> writes:

> hi,
>
> I am in the process of creating a gradle build system for the Freeplane
> project. The (OSGi-)structure is simple:
>
> - the 'freeplane' (core) project (OSGi plugin) contains core code as
>   well as dependencies like commons-lang, commons-io, flamingo etc.
>
> - the plugin projects ('freeplane_plugin_latex', 'freeplane_plugin_script',
>   ...) make use of some core classes *and* third-party dependencies
>   like commons-lang, commons-io, flamingo, ...
>
> In order not to duplicate third-party-deps in all plugins [1], the old ant
> code used to Require-Bundle: the core project in all plugin projects.
>
> Since Require-Bundle: is not recommended practice any more, we decided
> to Export-Package: the third-party-deps in the core project and
> Import-Package: them in the plugin projects:
>
> // core project MANIFEST
> Export-Package: [...]
>  org.pushingpixels.flamingo.api.common,
>  org.pushingpixels.flamingo.api.common.icon,
>  org.pushingpixels.flamingo.api.common.model,
>  org.pushingpixels.flamingo.api.common.popup,
>  org.pushingpixels.flamingo.api.ribbon
>
> // plugin project MANIFEST
> Import-Package: [...]
>  org.pushingpixels.flamingo.api.common,
>  org.pushingpixels.flamingo.api.common.icon,
>  org.pushingpixels.flamingo.api.common.model,
>  org.pushingpixels.flamingo.api.common.popup,
>  org.pushingpixels.flamingo.api.ribbon
>
> When we build Freeplane using gradle outside of eclipse, this works
> when bypassing 'bnd' (a tool that helps generating OSGi MANIFESTs),
> details are in [2].
>
> However, when building/starting from Eclipse (Eclipse for RCP and RAP
> Developers), Eclipse does not allow me to Export-Package:
> i.e. org.pushingpixels.flamingo.api.common.* (probably because it's from
> a third-party jar).

I found out what the problem ist:

Gradle references dependency jars from outside the workspace
(i.e. ~/.gradle/caches/...), and in this case, eclipse refuses to
Export-Package: packages from this jar.

=> copy the jars to <project>/build/libs/foo.jar and reference it from
there in your MANIFEST.MF => eclipse will Export-Package: just fine.

Best Regards,
-- 
Felix Natter



Back to the top