quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.8k stars 2.68k forks source link

Add support for JPMS modules in dev mode / live coding #17747

Closed serahl closed 1 year ago

serahl commented 3 years ago

Description

As of 1.13.6.Final, when using dev mode / live coding alongside JPMS (meaning you have a module-info.java file in your sources), the live coding will break on the first change with a "module XXX not found" error. Building a jar or initially starting dev mode works fine. I added a small sample project to clarify what I mean: quarkus-jpmstest.zip

It would be nice if the dev mode could get support for JPMS.

yrodiere commented 2 years ago

Also reported as #25836 by rmanibus with a separate reproducer and (probably) a more recent version of Quarkus:

Reproducer: https://github.com/rmanibus/quarkus_25836

It's not the same error than in my app thought. It's failing with

Compilation Failed:
error: module not found: java.xml.bind
error: module not found: java.ws.rs
y-luis-rojo commented 2 years ago

Similar error here, but with some different modules in a Maven multi-module project. Log of quarkus:remote-dev -Dquarkus.live-reload.url=http://localhost:8080:

Compilation Failed:
error: module not found: io.vertx.core
error: module not found: java.transaction
error: module not found: quarkus.hibernate.reactive.panache
error: module not found: com.fasterxml.jackson.annotation
error: module not found: io.smallrye.common.annotation
error: module not found: java.xml.bind
error: module not found: io.smallrye.mutiny
error: module not found: java.ws.rs
error: module not found: jakarta.inject.api
error: module not found: jakarta.enterprise.cdi.api
error: module not found: com.fasterxml.jackson.core
error: module not found: com.fasterxml.jackson.databind
error: module not found: java.persistence
error: module not found: org.hibernate.orm.core
error: module not found: lombok
error: module not found: application
error: module not found: domain
2022-10-13 15:23:32,619 ERROR [io.qua.dep.dev.JavaCompilationProvider] (Remote dev client thread) module not found: io.vertx.core, line -1 in [unknown source]
2022-10-13 15:23:32,619 ERROR [io.qua.dep.dev.JavaCompilationProvider] (Remote dev client thread) module not found: java.transaction, line -1 in [unknown source]
2022-10-13 15:23:32,619 ERROR [io.qua.dep.dev.JavaCompilationProvider] (Remote dev client thread) module not found: quarkus.hibernate.reactive.panache, line -1 in [unknown source]
2022-10-13 15:23:32,619 ERROR [io.qua.dep.dev.JavaCompilationProvider] (Remote dev client thread) module not found: com.fasterxml.jackson.annotation, line -1 in [unknown source]
2022-10-13 15:23:32,619 ERROR [io.qua.dep.dev.JavaCompilationProvider] (Remote dev client thread) module not found: io.smallrye.common.annotation, line -1 in [unknown source]
2022-10-13 15:23:32,619 ERROR [io.qua.dep.dev.JavaCompilationProvider] (Remote dev client thread) module not found: java.xml.bind, line -1 in [unknown source]
2022-10-13 15:23:32,620 ERROR [io.qua.dep.dev.JavaCompilationProvider] (Remote dev client thread) module not found: io.smallrye.mutiny, line -1 in [unknown source]
2022-10-13 15:23:32,620 ERROR [io.qua.dep.dev.JavaCompilationProvider] (Remote dev client thread) module not found: java.ws.rs, line -1 in [unknown source]
2022-10-13 15:23:32,620 ERROR [io.qua.dep.dev.JavaCompilationProvider] (Remote dev client thread) module not found: jakarta.inject.api, line -1 in [unknown source]
2022-10-13 15:23:32,620 ERROR [io.qua.dep.dev.JavaCompilationProvider] (Remote dev client thread) module not found: jakarta.enterprise.cdi.api, line -1 in [unknown source]
2022-10-13 15:23:32,620 ERROR [io.qua.dep.dev.JavaCompilationProvider] (Remote dev client thread) module not found: com.fasterxml.jackson.core, line -1 in [unknown source]
2022-10-13 15:23:32,620 ERROR [io.qua.dep.dev.JavaCompilationProvider] (Remote dev client thread) module not found: com.fasterxml.jackson.databind, line -1 in [unknown source]
2022-10-13 15:23:32,621 ERROR [io.qua.dep.dev.JavaCompilationProvider] (Remote dev client thread) module not found: java.persistence, line -1 in [unknown source]
2022-10-13 15:23:32,621 ERROR [io.qua.dep.dev.JavaCompilationProvider] (Remote dev client thread) module not found: org.hibernate.orm.core, line -1 in [unknown source]
2022-10-13 15:23:32,621 ERROR [io.qua.dep.dev.JavaCompilationProvider] (Remote dev client thread) module not found: lombok, line -1 in [unknown source]
2022-10-13 15:23:32,621 ERROR [io.qua.dep.dev.JavaCompilationProvider] (Remote dev client thread) module not found: application, line -1 in [unknown source]
2022-10-13 15:23:32,621 ERROR [io.qua.dep.dev.JavaCompilationProvider] (Remote dev client thread) module not found: domain, line -1 in [unknown source]

and log at browser:

java.lang.RuntimeException: Compilation Failed:
error: module not found: io.vertx.core
error: module not found: java.transaction
error: module not found: quarkus.hibernate.reactive.panache
error: module not found: com.fasterxml.jackson.annotation
error: module not found: io.smallrye.common.annotation
error: module not found: java.xml.bind
error: module not found: io.smallrye.mutiny
error: module not found: java.ws.rs
error: module not found: jakarta.inject.api
error: module not found: jakarta.enterprise.cdi.api
error: module not found: com.fasterxml.jackson.core
error: module not found: com.fasterxml.jackson.databind
error: module not found: java.persistence
error: module not found: org.hibernate.orm.core
error: module not found: lombok
error: module not found: application
error: module not found: domain
    at io.quarkus.deployment.dev.JavaCompilationProvider.compile(JavaCompilationProvider.java:110)
    at io.quarkus.deployment.dev.QuarkusCompiler.compile(QuarkusCompiler.java:226)
    at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.checkForChangedClasses(RuntimeUpdatesProcessor.java:716)
    at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:455)
    at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:437)
    at io.quarkus.deployment.dev.IsolatedRemoteDevModeMain.runSync(IsolatedRemoteDevModeMain.java:279)
    at io.quarkus.deployment.dev.IsolatedRemoteDevModeMain$6.get(IsolatedRemoteDevModeMain.java:269)
    at io.quarkus.deployment.dev.IsolatedRemoteDevModeMain$6.get(IsolatedRemoteDevModeMain.java:266)
    at io.quarkus.vertx.http.deployment.devmode.HttpRemoteDevClient$Session.run(HttpRemoteDevClient.java:225)
    at java.base/java.lang.Thread.run(Thread.java:833)
rteabeault commented 1 year ago

Hi Folks, We are in the process of evaluating Quarkus for use on a project. Our team is very focused on JPMS so getting this resolved would be helpful in advocating for Quarkus. Was wondering if there are any updates or known workarounds not present in this issue? Thanks!

maxandersen commented 1 year ago

@rteabeault this isssue is about jpms in devmode; is it affecting you at runtime too? would be great with a more recent update reproducer.

that said JPMS is not exactly friendly to the optimizations we get when using AOT/nativeimage and build time enhancements so depend on the usecases.

maxandersen commented 1 year ago

@rmanibus and @y-luis-rojo do you have a reproducer that builds using mvn package/gradle build but fails in quarkus dev?

both the reproducers above I can't build due to module not found just for the build.

kpagratis commented 1 year ago

I work with @rteabeault and have a reproducer. code-with-quarkus.zip

maxandersen commented 1 year ago

thanks @kpagratis I also can't simply build that reproducer. So just to confirm - can you confirm if the issue is about using jpms in dev mode or about using jpms at all?

I assume the latter but since 2 reports linked talks about devmode I want to check since I would be curious if someone actually had a jpms use that worked in build but failed in devmode.

kpagratis commented 1 year ago

The issue is with using jpms in dev mode. That reproducer should work.

When running dev mode with the reproducer, the app starts the first time, but the restart after an edit fails.

kpagratis commented 1 year ago
❯ ./gradlew quarkusDev

> Task :quarkusDev
Listening for transport dt_socket at address: 5005
Press [e] to edit command line args (currently ''), [h] for more options>
Tests pausedv
Press [e] to edit command line args (currently ''), [r] to resume testing, [h] for more options>
Press [e] to edit command line args (currently ''), [r] to resume testing, [o] Toggle test output, [h] for more options>
__  ____  __  _____   ___  __ ____  ______
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2023-09-13 09:02:43,719 INFO  [io.quarkus] (Quarkus Main Thread) code-with-quarkus 1.0.0-SNAPSHOT on JVM (powered by Quarkus 3.3.2) started in 1.253s. Listening on: http://localhost:8080
2023-09-13 09:02:43,722 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2023-09-13 09:02:43,722 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy-reactive, smallrye-context-propagation, vertx]

<===========--> 90% EXECUTING [14s]
> :quarkusDev
dmlloyd commented 1 year ago

I think we may be missing the forest for the trees here: is this more than a matter of filtering out module-info.java when we call javac in dev mode?

cescoffier commented 1 year ago

I was thinking about the same thing. Can we just ignore the module-info?

kpagratis commented 1 year ago

That would solve the execution issue, but there's still a great onus on the developer to define automatic modules for everything.

cescoffier commented 1 year ago

That would still be handle when running tests and regular build/execution. This would only be for the dev mode.

dmlloyd commented 1 year ago

Exactly, the only difference here is that projects with module-info descriptors would stop failing in dev mode per this bug report. There would be no change in our requirements, or support, or lack thereof, of JPMS to solve this specific issue.

kpagratis commented 1 year ago

I have concerns that this will cause confusion with developers. Invoking dev mode works but then attempting to build or run for deployment fails.

dmlloyd commented 1 year ago

If building or deployment does fail with JPMS, then please open a separate issue for this case. The fix for this issue would not affect that one way or the other.

kpagratis commented 1 year ago

I think if the module-info files are filtered out for dev mode that would unblock us while we wait for full support.

kpagratis commented 1 year ago

I think I'll need to create another ticket. Seems as if the GRPC version you pull in with quarkus 3.3.2 is very not compatible with JPMS. The latest version of grpc should have fixed the issues

cescoffier commented 1 year ago

@kpagratis please open a separate issue about gRPC. Updating gRPC requires a bit of orchestration (Netty / Vert.x / Quarkus alignment)

maxandersen commented 1 year ago

just to come back on this - the build does work for me now. not sure why it failed.

if filtering out module-info would work thats cool.

but @kpagratis fundamentally JPMS and automatic modules have so many inherent issues that I'll just be honest and say don't expect JPMS to be fully supported anytime soon; its more that we will be able to tolerate jars with module-info in them.

rteabeault commented 1 year ago

@maxandersen That is completely acceptable. Just wondering if we could get any sort of timeline for a fix?

dmlloyd commented 1 year ago

Could you try out #36200 and let me know if that fixes the issue for you @rteabeault and/or @kpagratis and/or @serahl and/or @y-luis-rojo? See @cescoffier's fix instead, please!

cescoffier commented 1 year ago

I proposed a fix here: https://github.com/quarkusio/quarkus/pull/36202

kpagratis commented 1 year ago

When is 3.5 scheduled to release?

cescoffier commented 1 year ago

@kpagratis I think it's getting released this week (at least for the core). @gsmet can confirm.

We must do more releases this week because of the recent HTTP/2 CVE. So, it will depend on the bandwidth, but it will happen soon.