You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently one can use for Import-Package a resolution:=dynamic so an import becomes an DynamicImport-Package, beside that one can add resolution:=optional to make it an optional import.
And then there is also conditionalpackage to embed packages (and not import them at all).
What I'm sometimes missing when wrapping third party code (but it can be useful in other cases as well) is something I will call here resolution:=conditional (while maybe computed would also be suitable as a name) that can be used like this:
Import-Package: *;resolution:=conditional
and then behaves in the following way:
Assume we have a package to be imported p
If pis found on the classpath and the jar is an OSGi bundle then p should be imported as usual possibly with a version range
If pis found on the classpath but the jar is not an OSGI bundle then p is considered an conditional package and embedded into the jar
If p is not found on the classpath it is imported with resolution:=optional (e.g. might be some com.sun.* class from the jdk or whatever e.g. a prebuild jar is analyzed and some dependencies are not available at that time)
This would be especially useful for cases where one needs to wrap an existing jar but can't add metadata in the first place, or if metadata should be added but the authors of that jar do not care much about OSGi and are afraid of having to know/manage that stuff individually.
The text was updated successfully, but these errors were encountered:
Currently one can use for Import-Package a
resolution:=dynamic
so an import becomes anDynamicImport-Package
, beside that one can addresolution:=optional
to make it an optional import.And then there is also conditionalpackage to embed packages (and not import them at all).
What I'm sometimes missing when wrapping third party code (but it can be useful in other cases as well) is something I will call here
resolution:=conditional
(while maybecomputed
would also be suitable as a name) that can be used like this:Import-Package: *;resolution:=conditional
and then behaves in the following way:
p
p
is found on the classpath and the jar is an OSGi bundle thenp
should be imported as usual possibly with a version rangep
is found on the classpath but the jar is not an OSGI bundle thenp
is considered an conditional package and embedded into the jarp
is not found on the classpath it is imported withresolution:=optional
(e.g. might be somecom.sun.*
class from the jdk or whatever e.g. a prebuild jar is analyzed and some dependencies are not available at that time)This would be especially useful for cases where one needs to wrap an existing jar but can't add metadata in the first place, or if metadata should be added but the authors of that jar do not care much about OSGi and are afraid of having to know/manage that stuff individually.
The text was updated successfully, but these errors were encountered: