You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Bernd Eckenfels (JIRA)" <ji...@apache.org> on 2016/09/07 10:50:20 UTC

[jira] [Commented] (CONFIGURATION-639) OSGi Import-Package declaration not complete regarding optional dependencies

    [ https://issues.apache.org/jira/browse/CONFIGURATION-639?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15470278#comment-15470278 ] 

Bernd Eckenfels commented on CONFIGURATION-639:
-----------------------------------------------

The bundle plugin can do that automatically. With one of the later commons-parent I have implemented an additional property which can overwrite a exclude statement (I dont know why it is needed, but if you overwrite it the import statements have the proper resolution added automatically. (We could even remove the manual resolution overwrites).

{quote}
<!-- make sure bundle plugin has dependency informations for 'optional' -->
<commons.osgi.excludeDependencies />
{quote}

When doing this the optional shows up for spring then:

{quote}
org.springframework.beans.factory;resolution:=optional,
org.springframework.core.env;resolution:=optional,
org.springframework.core.io;resolution:=optional,
org.springframework.util;resolution:=optional
{quote}

However for some packages it also adds version ranges:

org.apache.commons.beanutils;resolution:=optional;version="[1.9,2)",
org.apache.commons.codec.binary;resolution:=optional;version="[1.10,2)"
,,,

Not sure if we want to keep this or turn versions off if not?



> OSGi Import-Package declaration not complete regarding optional dependencies
> ----------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-639
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-639
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 2.1
>         Environment: OSGi-container
>            Reporter: Rico Neubauer
>              Labels: commons-configuration, osgi
>
> common-configuration2's pom.xml correctly defines optional dependencies like vfs2 or spring with <optional>.
> However, it does only declare a subset of those as optional OSGi-dependencies:
> {code:xml}
>     <!-- Explicitly declare optional dependencies for the OSGi manifest. -->
>     <commons.osgi.import>
>       org.apache.commons.beanutils.*;resolution:=optional,
>       org.apache.commons.codec.*;resolution:=optional,
>       org.apache.commons.jxpath.*;resolution:=optional,
>       org.apache.xml.resolver.*;resolution:=optional,
>       javax.servlet.*;resolution:=optional,
>       org.apache.commons.jexl2.*;resolution:=optional,
>       org.apache.commons.vfs2.*;resolution:=optional,
>       *
>     </commons.osgi.import>
> {code}
> See https://github.com/apache/commons-configuration/blob/trunk/pom.xml for both above.
> Due to the missing "resolution:=optional, commons-configuration2 cannot be deployed in an OSGi-environment not providing the optional bundles.
> Example error on deploy:
> {code}
> Unable to resolve Module[org.apache.commons.configuration:2.1.0]: missing requirement [Module[org.apache.commons.configuration:2.1.0]] package; (package=org.springframework.beans.factory)
> {code}
> Please have a look if you agree and add the missing instructions for the remaining optional dependencies.
> Manually fixed export-package statement looks like this (disregarding line-breaks):
> {code}
> Export-Package: org.apache.commons.configuration2;version="2.1",org.apache.commons.configuration2.beanutils;version="2.1",org.apache.commons.configuration2.builder;version="2.1",org.apache.commons.configuration2.builder.combined;version="2.1",org.apache.commons.configuration2.builder.fluent;version="2.1",org.apache.commons.configuration2.convert;version="2.1",org.apache.commons.configuration2.event;version="2.1",org.apache.commons.configuration2.ex;version="2.1",org.apache.commons.configuration2.interpol;version="2.1",org.apache.commons.configuration2.io;version="2.1",org.apache.commons.configuration2.plist;version="2.1",org.apache.commons.configuration2.reloading;version="2.1",org.apache.commons.configuration2.resolver;version="2.1",org.apache.commons.configuration2.spring;version="2.1",org.apache.commons.configuration2.sync;version="2.1",org.apache.commons.configuration2.tree;version="2.1",org.apache.commons.configuration2.tree.xpath;version="2.1",org.apache.commons.configuration2.web;version="2.1"
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)