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

Balazs Zsoldos commented on FELIX-4626:
---------------------------------------

Debugged it out. The issue might come from aQute.bnd.osgi.Analyzer. See the 
following lines (147-157 in bndlib 2.3.0):

{code:java}
//
// Get exported packages from the
// entries on the classpath and
// collect any contracts
//

for (Jar current : getClasspath()) {
        getManifestInfoFromClasspath(current, classpathExports, contracts);
        for (String dir : current.getDirectories().keySet())
                learnPackage(current, getPackageRef(dir), classpathExports);
}
{code}

This iteration goes through all of the jars in the dependency list, starting 
with the current project. I guess classpathExports variable should contain only 
the exported packages from the dependencies, however it will contain all of the 
packages in the end. E.g.: if the current project exports _a.b.c_ package, the 
*classpathExports* will contain _a_, _a.b_ and _a.b.c_ as well. As the first 
two are not exported, they will be there without a version.

As the *classpathExports* variable is used later to determine the version in 
the import-package section, the non-exported parent packages will cause a 
problem.

> maven-bundle-plugin does not insert package range to Import-Package clause
> --------------------------------------------------------------------------
>
>                 Key: FELIX-4626
>                 URL: https://issues.apache.org/jira/browse/FELIX-4626
>             Project: Felix
>          Issue Type: Bug
>    Affects Versions: maven-bundle-plugin-2.5.0
>            Reporter: Balazs Zsoldos
>
> With maven-bundle-plugin 2.4.0 everything is ok:
> {code}
> Import-Package: org.everit.osgi.cache;version="[2.0,3)",org.osgi.framewo 
> rk;version="[1.6,2)"
> {code}
> With version 2.5.0 the header is the following:
> {code}
> Import-Package: org.everit.osgi.cache,org.osgi.framework;version="1.6,2)"
> {code}
> The version range from org.everit.osgi.cache package is missing.
> __To reproduce:__
>  - Check out the repository https://github.com/everit-org/cache-noop
>  - Replace the version of maven-bundle-plugin from 2.4.0 to 2.5.0.
> The sample project and its dependency has 1-1 package.
> I created an issue for bndlib but I got the response that this might be a bug 
> of maven-bundle-plugin.



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

Reply via email to