I wonder if there is a efficient way/best practice to exclude all the imports of a specific java module from the target JRE of a library wrapping project. e.g. exclude
java.xml module imports.
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=11))" is provided all contained modules of the projects JRE could be directly ignoring the
Import-Package instruction for modules/packages contained.
Currently I maintain a exclusion list for the java modules contained in the target JavaSE version.
e.g. the following to exclude imports statements for module
Any hints or tips are highly appreciated.
I am not sure what harm they do? The framework will export them? It sounds very much like you want to encode a runtime choice in a build time artifact? If you do this, why bother with OSGi since you remove all the safety mechanisms OSGi added? For me these headers are a serious bad code smell.
If I see an import package statement like this at a client (and I see many) the first action is to remove it immediately. It only is a problem in wrapper projects where you’re not in control of the source code.
But I could be wrong …
Thx for the inputs.
I totally agree with @pkriens, that it should not matter if they are in. But inside Eclipse PDE bundles containing java imports are causing strange warning during launches.
So I try to create a small example repo to report a bug to Eclipse PDE on this.
In between for my bnd wrapped bundles I try to avoid the generation.
@rotty3000 Yes I’m already using that instruction, but is only for
java.* and lacks the 'javax.*`and other java internal packages from within the java 11 runtime.