[
https://issues.apache.org/jira/browse/FELIX-954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13055595#comment-13055595
]
Holger Hoffstätte commented on FELIX-954:
-----------------------------------------
Thanks Stuart. I understand the reasons for wanting this (legacy integration)
and, if I had my way ;) - would even argue that support for optional
dependencies should be removed from OSGi proper..but that's a different
discussion. As for problems, an easy scenario is a bundleized library L that
enables different features (using its own broken plugin system or just
Class.forName()) depending on more or less random availability of optional
imports. Now imagine two service bundles A & B which both need L, but with
mutually exclusive requirements: A must have L(nodeps), whereas b might need
L(optional deps). I don't think relying on resolution/wiring/start order to
solve this is a good way forward. If there is a good way to fix this without
forcing A and B to embed their required flavour of L, I'd love to learn how.
As for the (much) bigger picture which I had in mind - all this would make more
sense if it were discussed in the context of subsystems, to prevent
arbitrarily-/ill-defined optionality from spilling over from "application
scope" into the global framework scope. I know that's a bit more context than
most people have in mind, esp. the original use case of gradual bundleization
etc. I'm just afraid that more lenient default behaviour "to make things easier
for beginners" will ultimately make things much harder in the long run and
reinforce bad habits.
> Import-Package should include packages from optional Maven dependencies with
> resolution=optional
> ------------------------------------------------------------------------------------------------
>
> Key: FELIX-954
> URL: https://issues.apache.org/jira/browse/FELIX-954
> Project: Felix
> Issue Type: New Feature
> Components: Maven Bundle Plugin
> Affects Versions: maven-bundle-plugin-1.4.3
> Reporter: Pavol Juhos
> Fix For: maven-bundle-plugin-2.4.0
>
>
> It would be great if maven-bundle-plugin used resolution=optional for
> packages that are coming from _optional_ Maven dependencies.
> The current behavior causes problems e.g. when embedding libraries with lots
> of optional dependencies. As described by Detelin Yordanov: "[I]t seems that
> BND finds the
> references to [the optional packages] and assumes them to be mandatory adding
> a bunch of imports in the manifest." This can easily result in hundreds of
> import-package declarations importing packages that are actually not required
> by the application. In these cases it is not practical to handle this
> manually in the plug-in / BND configuration.
> This issue was already discussed on felix-users list in Jan 2009 -- see
> thread "Maven bundle plugin: Is it possible to mark optional Maven
> dependencies to be imported with resolition=optional"
> http://mail-archives.apache.org/mod_mbox/felix-users/200901.mbox/%[email protected]%3E
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira