quarkusio / quarkus

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

Using AdditionalStaticResourceBuildItem is not always working propertly in dev-mode #39735

Closed ia3andy closed 1 month ago

ia3andy commented 4 months ago

Describe the bug

Currently, if there is no meta-inf/resources files, then Quarkus is using a cache when instantiating the StaticHandler, when using AdditionalStaticResourceBuildItem, we don't necessarily have a meta-inf/resources at buildtime as it's generated.

This leads to caching issue as described here: https://github.com/quarkiverse/quarkus-web-bundler/issues/171

Expected behavior

Files added with AdditionalStaticResourceBuildItem shouldn't be cached in dev-mode.


The solution might be to split in to handers:

ia3andy commented 4 months ago

We discussed it with @cescoffier and here is the proposed solution:

Create a new GeneratedStaticResourceBuildItem(String publicPath, byte[] content), the BuildStep will take care of:

ia3andy commented 4 months ago

Here is what we are trying to avoid: https://github.com/quarkiverse/quarkus-web-bundler/blob/main/deployment/src/main/java/io/quarkiverse/web/bundler/deployment/web/GeneratedWebResourcesProcessor.java

ia3andy commented 4 months ago

For the dev handled, a lot of logic can be extracted from here: https://github.com/vert-x3/vertx-web/blob/master/vertx-web/src/main/java/io/vertx/ext/web/handler/impl/StaticHandlerImpl.java

mcruzdev commented 4 months ago

Can assign it to me @ia3andy ?

ia3andy commented 3 months ago

@mcruzdev I found a good follow issue for you :)

https://github.com/quarkusio/quarkus/issues/39968