-
Notifications
You must be signed in to change notification settings - Fork 568
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
examples/integrations/oci/objectstorage-cdi fails when run in IntelliJ IDEA (module-info) #4847
Comments
If module-info.java causes issues in IDE and expectation is still to run some example via classpath - then I'd say alternative set of examples supporting module-info should be present. That will then allow those, who already works in the space of Java modules to evaluate those example via Java module approach. And if IDE doesn't work for that - then via Maven CLI. |
But what is driving that removal decision? In Ide profile one could add needed --add-opens/--add-exports switches while invoking underlying JDK and those should resolve similar to above issues with unnamed modules access. At the same time it could help identify what else left in overall ecosystem still unnamed and make that named to everyone's benefit. |
@andrejusc it is very important to us that our examples work with as little friction as possible. Having module-info in an example adds friction when used with IntelliJ. We have seen this repeatedly trip up our users. So, "by default", Helidon examples won't include But, as @romain-grecourt said, we do plan on having some examples whose purpose is to demonstrate the use of module path so users that care about JPMS can reference those examples. |
@barchetta - this is interesting topic in itself about Jigsaw (aka Java modules) adoption/friction/IDE and Helidon. In some sense I think we have here contradicting goals:
Till recent 2022.1.x version Intellij IDE had issues itself to support Java modules in robust way. They did multiple gradual enhancements. There was long and elaborated discussion under this issue: https://youtrack.jetbrains.com/issue/IDEA-273159 and some other IDE issues were linked to that as well. By removing I need to admit that I didn't yet try any of referenced examples inside IDE and see what is the root cause if module-info.java is present. But even looking at your short error output - who on the earth would be able decode fast what Each adoption faces friction, but if there is common belief (see my question earlier) that adoption is good - then effort to address friction (and not just put it aside) will be around. |
@barchetta - I downloaded now Helidon 2.5.3 release and examples and built such: and did initially very primitive Java modules validation test with GraalVM 22.2 and JDK17 like such:
which to my surprise failed with such:
Such initial failure at least indicates that collected dependencies have clash from Java modules angle and that should be resolved first before returning to friction in IDE aspect/discussion. And no surprise that one of clashing dependencies is brought by referenced OCI SDK 2.41, i.e. this one:
while good one coming from Helidon:
And so Java modules in this regards play quite good guard role of saying that one or another should be used, but not potentially both. In one of projects I'm dealing with - I've explicitly added invocation of above Looking at above issue makes me think that such enhancement could make sense to those examples, which will be presenting Java modules functionality through them. |
This is a dependency convergence issue. Can you share the output of |
Validation of java modules is challenging, this is an area where we can improve. Though doing it from the examples is not practical. |
Please see dependency tree for this specific example under discussion Validation is not challenging actually - doing that already for 3+ months at least. Could share my Maven approach for that if you wish. I think it should be introduced for Helidon project regardless it's core or examples. Only then we'll be able to claim we support and use Java modules properly. |
We have 200+ artifacts and a dependency graph that we ship for each of them, validating that is VERY challenging. |
I assume you're building each separate component's POM in your pipelines to see if that building is not failing. For this example you could see already it copies all dependencies into But even without this aggregation into single i.e. something like this:
|
And assuming that for each POM dependencies meant to be Java modules (maybe need to filter out of
So even with 200+ or more dependencies - having this in some common Maven profile and activating where desired - should solve Java modules validation in consistent fashion. |
@romain-grecourt - for this one:
If we agree on value of |
Attached is modified additional which demonstrates explained above and combined technique of dependencies validation as modules. You could invoke it like such:
and once it's done - you could launch example in fully modularized way like such:
and it should get to the point of this:
But I could also reproduce your original issue in IDE even after resolving modules conflicts for CLI case. Which is weird. |
We are going tackel |
@arjav-desai - thank yo for update. Though we didn't reach here proper working state within IDE for example under discussion - -hope you could then introduce approach based on my proposed |
Checkout out the 2.5.2 tag and load
integrations/oci/objectstorage-cdi
example into IntelliJ. OpenObjectStorageCdiMain.java
and click the green triangle to "Run ObjectStorageCdiMain.main()" it will fail with:When run via the command line using
java -jar
it works as expected. If you removemodule-info.java
it works as expected in IntelliJ. Apparently the presence of themodule-info.java
file informs IntelliJ to run the application as a module and there is no simple way to prevent this. I say simple because there are some alternatives, but they add friction to users that are just trying to load and run our examples.Some additional info concerning options in IntelliJ IDEA:
Do not use --module-path
option (under Modify Options), but the Application configuration template does not.So the cleanest solution might be to remove
module-info.java
files from examples that don't need it.Examples in 2.x that have
module-info.java
. We should consider removing these:The text was updated successfully, but these errors were encountered: