Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding module-descriptors again. #42

Merged
merged 6 commits into from
Feb 13, 2025
Merged

Adding module-descriptors again. #42

merged 6 commits into from
Feb 13, 2025

Conversation

ethlo
Copy link
Owner

@ethlo ethlo commented Feb 12, 2025

No description provided.

Copy link

codecov bot commented Feb 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.34%. Comparing base (5a4d236) to head (1d838e9).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main      #42   +/-   ##
=========================================
  Coverage     89.34%   89.34%           
  Complexity      314      314           
=========================================
  Files            27       27           
  Lines           732      732           
  Branches        125      125           
=========================================
  Hits            654      654           
  Misses           47       47           
  Partials         31       31           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ethlo ethlo mentioned this pull request Feb 12, 2025
Copy link

@merks merks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

@ethlo ethlo requested a review from merks February 12, 2025 10:37
@ethlo
Copy link
Owner Author

ethlo commented Feb 12, 2025

@lscoughlin Is this acceptable now?

@ethlo ethlo mentioned this pull request Feb 12, 2025
@lscoughlin
Copy link

The maven plugin you're using to generate the the module-info.java just doesn't work.

@ethlo
Copy link
Owner Author

ethlo commented Feb 12, 2025

The maven plugin you're using to generate the the module-info.java just doesn't work.

Can you please point out what is the problem, as I need to keep this plugin to have the OSGi generated AFAIK.

I decompiled the META-INF/versions/9/module-info.class using IntelliJ:

module com.ethlo.time.itu {
    exports com.ethlo.time;
    exports com.ethlo.time.token;
}

Is this not correct?

Copy link

@merks merks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't judge so much of this but I see it's bundle packaging and using maven-bundle-plugin so that looks good to me. If at some point there is a repo with the snapshot artifact I can have a look at that...

@ethlo
Copy link
Owner Author

ethlo commented Feb 12, 2025

I can't judge so much of this but I see it's bundle packaging and using maven-bundle-plugin so that looks good to me. If at some point there is a repo with the snapshot artifact I can have a look at that...

Snapshots are available here: https://oss.sonatype.org/content/repositories/snapshots

@ethlo
Copy link
Owner Author

ethlo commented Feb 12, 2025

@lscoughlin It does indeed seem to work. I took the time to create a super-simple sample project, and this seems to work just fine. I just added this to the sample project:

module com.example.modularproject {
    requires com.ethlo.time.itu;
}

@lscoughlin
Copy link

java -p [simpelproject.jar] --list-modules and see if your module is declared.
Because it's not showing up for itu, and i get runtime errors from the new build with exactly the same message.

@merks
Copy link

merks commented Feb 12, 2025

Snapshots are available here: https://oss.sonatype.org/content/repositories/snapshots

When I go there, it just shows:

image

I do have an account there and tried it when being logged in as well. Maybe the staging repo isn't visible or I need a longer URL for it?

@ethlo
Copy link
Owner Author

ethlo commented Feb 12, 2025

I do have an account there and tried it when being logged in as well. Maybe the staging repo isn't visible or I need a longer URL for it?

Sorry, i just gave you the base-path of the repo: https://oss.sonatype.org/content/repositories/snapshots/com/ethlo/time/itu/1.12.0-SNAPSHOT/

@ethlo
Copy link
Owner Author

ethlo commented Feb 12, 2025

java -p [simpelproject.jar] --list-modules and see if your module is declared. Because it's not showing up for itu, and i get runtime errors from the new build with exactly the same message.

Thanks for bearing with me!

I created https://github.com/ethlo/simple-modular-demo so we can compare notes and I have something reproducible.

I tested with java --module-path target/itu-1.12.0-SNAPSHOT.jar --list-modules | grep itu

Output:

com.ethlo.time.itu@1.12.0-SNAPSHOT file:///home/morten/dev/ethlo/itu/target/itu-1.12.0-SNAPSHOT.jar

I do not try to make this difficult, but I would like to have something to evaluate and test this going forward.

@lscoughlin
Copy link

lscoughlin commented Feb 12, 2025

Something must of been wrong with my build then. :/
you can test it by just running something that requires it on the module path.

@ethlo
Copy link
Owner Author

ethlo commented Feb 12, 2025

Something must of been wrong with my build then. :/ you can test it by just running something that requires it on the module path.

Could you pull the simple project and have a look that I have not done anything wrong? Could perhaps serve as a clean slate for evaluating this? Thank you.

@lscoughlin
Copy link

lscoughlin commented Feb 12, 2025

That should do it. If you have sample service have a static void main method so it's launch-able you can launch it after build with java --module-path ./target --add-modules=ALL-SYSTEM com.example.modularproject/sample/SampleService

( you'll have to copy the lib into ./target too, but you can do that with the mvn-dependencies:copy plugin )

From the sample project your specify the module name as different than you have in the past ( com.ethlo.time vs com.ethlo.time.itu ) and so you should see the issue depending ( required module missing ). networknt binds against the com.ethlo.time module name.

@ethlo
Copy link
Owner Author

ethlo commented Feb 12, 2025

The com.ethlo.time is not correct, as both ITU and Chronograph would be in the same namespace/module then. I'd like to make things right with the 1.12 release, so com.ethlo.time.itu is intended to stay. I assume this is relatively unproblematic to update for a consumer of the library?

@ethlo
Copy link
Owner Author

ethlo commented Feb 12, 2025

I added a main method if you want to run it, btw. I see it already builds fine on the the GitHub action (https://github.com/ethlo/simple-modular-demo/actions/runs/13291400617/job/37112862158)

@ethlo
Copy link
Owner Author

ethlo commented Feb 13, 2025

@lscoughlin I updated the sample project and made sure it works fine. Are these changes acceptable for a 1.12.0 release, from your perspective?

@lscoughlin
Copy link

Yup -- that's perfect. I just want to note that your previous module name was com.ethlo.time not com.ethlo.time.itu so you're going to break downstream module dependencies like networknt's :).

@ethlo ethlo merged commit 2dc30b1 into main Feb 13, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants