[ https://issues.apache.org/jira/browse/CONFIGURATION-639?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15471650#comment-15471650 ]
Oliver Heger commented on CONFIGURATION-639: -------------------------------------------- In an older version of the bundle plugin the optional declarations from the pom were not taken into account, and all dependencies were listed as mandatory in the import-package directive. This was the reason for the explicit import declaration in the pom. If the plugin now handles optional dependencies correctly, we could drop this block. The versions, however, could be a problem. The dependencies (at least to other commons components) are typically set to the most recent versions, even if an older version would still work. Forcing users to always deploy the most recent version of a dependency could be too restrictive. > 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 > Attachments: s1.txt, s2.txt > > > 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 Import-package statement looks like this (disregarding > line-breaks): > {code} > Import-Package: > javax.naming,javax.servlet;resolution:=optional,javax.sql,javax.xml.parsers,javax.xml.transform,javax.xml.transform.dom,javax.xml.transform.stream,org.apache.commons.beanutils;resolution:=optional,org.apache.commons.codec.binary;resolution:=optional,org.apache.commons.jexl2;resolution:=optional,org.apache.commons.jxpath;resolution:=optional,org.apache.commons.jxpath.ri;resolution:=optional,org.apache.commons.jxpath.ri.compiler;resolution:=optional,org.apache.commons.jxpath.ri.model;resolution:=optional,org.apache.commons.lang3;version="[3.3,4)",org.apache.commons.lang3.builder;version="[3.3,4)",org.apache.commons.lang3.concurrent;version="[3.3,4)",org.apache.commons.lang3.mutable;version="[3.3,4)",org.apache.commons.lang3.text;version="[3.3,4)",org.apache.commons.lang3.text.translate;version="[3.3,4)",org.apache.commons.logging;version="[1.2,2)",org.apache.commons.logging.impl;version="[1.2,2)",org.apache.commons.vfs2;resolution:=optional,org.apache.commons.vfs2.provider;resolution:=optional,org.apache.xml.resolver;resolution:=optional,org.apache.xml.resolver.helpers;resolution:=optional,org.apache.xml.resolver.readers;resolution:=optional,org.apache.xml.resolver.tools;resolution:=optional,org.springframework.beans.factory;resolution:=optional,org.springframework.core.env;resolution:=optional,org.springframework.core.io;resolution:=optional,org.springframework.util;resolution:=optional,org.w3c.dom,org.xml.sax,org.xml.sax.helpers > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)