micrometer icon indicating copy to clipboard operation
micrometer copied to clipboard

Add BND plugin and OSGi export core package.

Open driessamyn opened this issue 3 years ago • 2 comments

This change enables the generation of OSGi metadata for all JARs (so turns them into OSGi bundles). A couple of notes:

  • exportcontents: io.micrometer.* is a bit "brute force". Ideally, we would only export the packages that are considered "API" and people will consume in their applications. However, I'm not familiar enough with the Micrometer structure to judge whether this should be more fine-grained or if this "export all packages" approach is ok.
  • OSGi will resolve all dependencies listed in the Import-Packages section in the manifest, unless they are explicitly marked as optional.
  • Because a jar has OSGi metadata does not necessarily mean it's usable in an OSGi framework as all the transitive dependencies need to have this metadata too.
  • I have tested this change in our local OSGi application using the Prometheus registry only. I suspect not all registries will work in an OSGi environment because of the above comment. This is something that would need to be resolved in the downstream code, however.

I believe this PR would also resolve this issue: https://github.com/micrometer-metrics/micrometer/issues/3149

driessamyn avatar Oct 05 '22 16:10 driessamyn

@driessamyn Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

pivotal-cla avatar Oct 05 '22 16:10 pivotal-cla

:warning: 10 God Classes were detected by Lift in this project. Visit the Lift web console for more details.

sonatype-lift[bot] avatar Oct 05 '22 17:10 sonatype-lift[bot]

@driessamyn Could you rebase on the latest main? I was trying to do that and see if I could get the build to pass, but I was having trouble getting the task testOSGi to pass after rebasing.

shakuzen avatar Feb 15 '23 11:02 shakuzen

@driessamyn Could you rebase on the latest main? I was trying to do that and see if I could get the build to pass, but I was having trouble getting the task testOSGi to pass after rebasing.

@shakuzen I rebased with the main branch and resolve the gradle file conflicts. I validated the testOSGi target (./gradlew :micrometer-osgi-test:testOSGi).

Let me know if there is anything else you need.

driessamyn avatar Feb 24 '23 17:02 driessamyn

@driessamyn Thank you for signing the Contributor License Agreement!

pivotal-cla avatar Mar 03 '23 08:03 pivotal-cla