Add java module system declarations - #333
Conversation
Core is in Java 7, so it can only have automatic module name, set via jar manifest. Forwarder gets a real declaration, which declares a transitive dependency on the core package. One wrinkle is that this breaks `mvn test`: automatic module name is only added to the packaged jar, which is not built when running tests, and then the forwarder tests are unable to find core module and fail. `mvn package` is a workaround, since it also builds jar for core, which is then used to run forwarder tests.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0304ae3097
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| /** HTTP forwarder for DogStatsD metrics. */ | ||
| module com.datadoghq.dogstatsd.http.forwarder { | ||
| requires transitive com.datadoghq.dogstatsd.http; |
There was a problem hiding this comment.
Make the core module resolvable before package
When the dogstatsd-http reactor is built only through compile/test (for example mvn test), this requires asks javac for com.datadoghq.dogstatsd.http, but that name only exists in the core artifact's packaged JAR manifest via Automatic-Module-Name; before the package phase Maven has only core's target/classes, which has no module descriptor or manifest, so the forwarder compile fails with module not found. This leaves the standard test workflow broken unless developers remember to run a later lifecycle phase first.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The fix for this is to add module-info.java, which is Java 9+ and doesn't work on Java 7. Someday.
Core is in Java 7, so it can only have automatic module name, set via jar manifest.
Forwarder gets a real declaration, which declares a transitive dependency on the core package.
One wrinkle is that this breaks
mvn test: automatic module name is only added to the packaged jar, which is not built when running tests, and then the forwarder tests are unable to find core module and fail.mvn packageis a workaround, since it also builds jar for core, which is then used to run forwarder tests.