I did try the -noimport directive, but as you note, it doesn't seem to be
globally configurable. As soon as I define my own Export-Package, I lose the
nice useful default of "all this project's own packages", and our current
transitional state moving into OSGi makes this a big cost. Attaching that
directive to the special macro of {local-packages} does not yield the desired
result either -- apparently directives don't scope over that the way they scope
over wildcards.
I also tinkered a bit with the macros, but bizarrely, ${@} does not seem to
resolve to anything for the bundle's own packages (though it works fine for
dependencies) -- it passes through to the manifest as those literal characters.
I suspect this may have the same root cause as the original issue of imports
being generated with no version at all, since this is also what happens when
you try to use that macro for imports that Maven can't associate with a version
(e.g., JRE packages, or manually specified package imports which you forgot in
the Maven dependencies).
-----Original Message-----
From: Bernd Eckenfels <[email protected]>
Sent: Monday, 01 July, 2019 16:06
To: [email protected]
Subject: Re: Maven Plugin Imports my Exports Without Version
External Email – Think before clicking links or attachments.
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 <[email protected]>
Gesendet: Montag, Juli 1, 2019 9:28 PM
An: [email protected]
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
[email protected]<mailto:[email protected]> | pronouns: he or
they<http://pronoun.is/he?or=they/.../themself>
PJM Interconnection | 2750 Monroe Blvd. | Audubon, PA 19403
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]