micrometer icon indicating copy to clipboard operation
micrometer copied to clipboard

Add explicit module-info

Open bowbahdoe opened this issue 1 year ago • 7 comments

Please describe the feature request.

This is a follow up to #1242 which gave a stable module name. The next step is to add an actual module descriptor.

Rationale

To be able to use jlink, everything on your dependency tree needs to be an explicit module.

This is the graph of what spring-web brings in. Red is no module info, Yellow is automatic module info, Green is full module descriptor. I am working through all the artifacts which are not maintained by Spring to see what I can do.

image

Additional context

There are 3 broad ways to do this.

  1. Bump the entire project to a higher Java version. Add a module-info.java, update build plugins, etc.
  2. Set up multi-release jars with a folder for "java 9" code where we put a module-info and configure the build
  3. Use the moditect plugin to generate a module info

The first is the best but has an obvious cost to it. The second and third I am used to setting up on Maven for folks. Nowhere near as comfortable with Gradle.

bowbahdoe avatar Apr 30 '24 20:04 bowbahdoe

Bump the entire project to a higher Java version.

This isn't possible without a new major version. I don't foresee that happening anytime soon.

Isn't a prerequisite of adding an explicit module-info.java that all dependencies we declare have at least an automatic module name? In micrometer-core, I see our dependencies don't: image We will have the same issue with some of the registry modules that have external dependencies.

shakuzen avatar May 01 '24 08:05 shakuzen

This isn't possible without a new major version. I don't foresee that happening anytime soon.

Ways 2 or 3 it is.

Isn't a prerequisite of adding an explicit module-info.java that all dependencies we declare have at least an automatic module name? In micrometer-core, I see our dependencies don't:

Okey dokie. Further into the mines I go.

I opened a PR on HDR histogram. Its last release was 4 years ago and they do have an automatic module name in their POM so maybe there just hasn't been a release since that.

After that, LatencyUtils (since it depends on HdrHistogram) https://github.com/LatencyUtils/LatencyUtils

A non-trivial part will be having those folks make maven central releases too.

We will have the same issue with some of the registry modules that have external dependencies.

One thing at a time I guess.

bowbahdoe avatar May 01 '24 13:05 bowbahdoe

@bowbahdoe HdrHistogram 2.2.1 is now released to maven central with your PR integrated. I can also do the same to LatencyUtils if you open a PR there.

giltene avatar May 05 '24 19:05 giltene

+1 from me for this feature request. I am building a command line application with jlink and currently I have to generate for each dependency without a module info a custom one with the help of moditect.

obfischer avatar Aug 27 '24 17:08 obfischer

I don't think we're opposed to doing this, but the ecosystem (our dependencies) still need to catch up, as far as I understand. This will be especially challenging if all of the optional dependencies we have (a lot) need an explicit or automatic module. I'm not sure on that point about optional dependencies, though.

shakuzen avatar Aug 28 '24 01:08 shakuzen

@shakuzen I'm working through it at the speed i am able. HDRHistogram is the one that needs to go first. they hit a bug in moditect i need to check if its fixed

bowbahdoe avatar Aug 28 '24 03:08 bowbahdoe

Hi all, I don‘t have any doubt, that you are on it. I simply added my comment to document, that there is a need for this feature in the real world ;-)

obfischer avatar Aug 28 '24 08:08 obfischer

@bowbahdoe there is another contrib to bring JPMS support https://github.com/HdrHistogram/HdrHistogram/pull/205 to HDR histogram

vietj avatar Jan 07 '25 15:01 vietj