Closed gbburkhardt closed 2 years ago
The annotation you mentioned are used only at compile time and are not retained at runtime. Therefore they are not necessary at runtime and should not be listed as requirement in the Manifest. In the original source-code repo the jar containing that annotations is embedded in the Eclipse Plug-in project and only added to the classpath at compile time. See
If you only use the bundle's jar from any eclipse P2 repo it should not be necessary and if you use the sources of org.eclipse.osgi
(e.g. because you maintain a patched version of it) make sure you have set up your project like the original.
This came up because the 'javac' compiler tries to pull it in when we're generating header files for JNI code. For whatever reason, BundleActivator is used, and then all imports are also needed. Without the annotation classes, 'javac' fails.
Looks like javac is too eager. Because at least at runtime those annotations are not present. However if you can 'add' the jar directly you can simply get it from Maven-Central: https://search.maven.org/search?q=g:org.osgi%20AND%20a:org.osgi.annotation.versioning
The class org.osgi.framework.BundleActivator imports org.osgi.annotation.versioning.ConsumerType, but the osgi.annotation jar file isn't included in the standard distributions.