I think you would have to specify the package version with package-info.java in 
order to get a specific version. But I am not sure if this applies to automatic 
imports as well. There is a whole section on how to specify a range with a 
macro: https://bnd.bndtools.org/heads/import_package.html

You can turn off the import with a -noimport directive on the export:

https://bnd.bndtools.org/heads/export_package.html
Exports are automatically imported. This features can be disabled with a 
special directive on the export instruction: -noimport:=true. For example:

Export-Package= com.acme.impl.*;-noimport:=true, *

(I never understood the implications, same for -nouses. Unlike 
<configuration><instructions><_nouses>true it seems not be able to be specified 
globally)

Gruss
Bernd



--
http://bernd.eckenfels.net

________________________________
Von: Hill, Colin <colin.h...@pjm.com>
Gesendet: Montag, Juli 1, 2019 9:28 PM
An: users@felix.apache.org
Betreff: Maven Plugin Imports my Exports Without Version

Hello,

On version 4.2.0 of maven-bundle-plugin, I am having trouble generating a 
manifest which imports its own exports with the proper version range.

For example, suppose my bundle defines the following class

package com.example.osgi.dependee;
import org.osgi.framework.ServiceListener;
import com.example.osgi.dependency.InternalDependency;
public class Dependee {
   private InternalDependency internalDependency;
   private ServiceListener externalDependency;
}

and also defines com.example.osgi.dependency.InternalDependency (whose 
implementation doesn’t matter here). With default configuration, the generated 
manifest headers are
Export-Package:
 com.example.osgi.dependee;version="1.0.0",
com.example.osgi.dependency;version="1.0.0"
Import-Package:
 com.example.osgi.dependency,
org.osgi.framework;version="[1.9,2)"

Is there any way to either:

1)     stop com.example.osgi.dependency from showing up in the imports, without 
having to explicitly name it?

2)     coerce maven-bundle-plugin into generating the expected version range of 
[1.0,2)?

Example project is attached.

Thanks,

Colin P. Hill
Application Developer, Development and Integration Services

colin.h...@pjm.com<mailto:colin.h...@pjm.com> | pronouns: he or 
they<http://pronoun.is/he?or=they/.../themself>
PJM Interconnection | 2750 Monroe Blvd. | Audubon, PA 19403

Reply via email to