quarkusio / quarkus

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

Dev UI v2 does not use custom pages when changing deployment module path location #35028

Open Vinetos opened 1 year ago

Vinetos commented 1 year ago

Describe the bug

I am creating an extension for my Quarkus project, and I have an issue where the BuildStep of creating the Dev UI cards and pages is executed but the result is not displayed.

This happens when I change the deployment artifactID to something which is not following Quarkus convention (<runtime>-deployment).

Expected behavior

DevUI should display the custom card and its content image

Actual behavior

DevUI only display the generated default card image

How to Reproduce?

Steps to reproduce the issue : 1- Create an extension mvn io.quarkus.platform:quarkus-maven-plugin:3.2.2.Final:create-extension -N -DgroupId=com.example -DextensionId=hello-extension

2- Configure DevUI for the extension

2-1 Add vertx-http-dev-ui-spi to deployment/pom.xml

Details ```xml io.quarkus quarkus-vertx-http-dev-ui-spi ```

2-2 Add the DevUIProcessor method :

Details ```java @BuildStep(onlyIf = IsDevelopment.class) void createJokes(BuildProducer cardsProducer, BuildProducer menuProducer, BuildProducer footerProducer) { // Cards CardPageBuildItem cardPageBuildItem = new CardPageBuildItem(); cardPageBuildItem.addPage(Page.rawDataPageBuilder("Raw data") .icon("font-awesome-brands:js") .buildTimeDataKey("jokes")); cardPageBuildItem.addPage(Page.tableDataPageBuilder("Table data") .icon("font-awesome-solid:table") .showColumn("timestamp") .showColumn("user") .showColumn("fullJoke") .buildTimeDataKey("jokes")); cardPageBuildItem.addPage(Page.quteDataPageBuilder("Qute data") .icon("font-awesome-solid:q") .templateLink("qute-jokes-template.html")); cardPageBuildItem.addPage(Page.webComponentPageBuilder() .icon("font-awesome-brands:vaadin") .componentLink("qwc-jokes-vaadin.js")); cardPageBuildItem.addPage(Page.webComponentPageBuilder() .icon("font-awesome-solid:chart-pie") .componentLink("qwc-jokes-chart.js")); cardPageBuildItem.addPage(Page.webComponentPageBuilder() .icon("font-awesome-solid:cubes") .componentLink("qwc-jokes-web-components.js")); cardsProducer.produce(cardPageBuildItem); // Menu MenuPageBuildItem menuPageBuildItem = new MenuPageBuildItem(); menuPageBuildItem.addPage(Page.webComponentPageBuilder() .icon("font-awesome-regular:face-grin-tongue-wink") .title("One Joke") .componentLink("qwc-jokes-menu.js")); menuPageBuildItem.addPage(Page.webComponentPageBuilder() .title("Jokes") .icon("font-awesome-solid:cubes") .componentLink("qwc-jokes-web-components.js")); menuProducer.produce(menuPageBuildItem); // Footer FooterPageBuildItem footerPageBuildItem = new FooterPageBuildItem(); footerPageBuildItem.addPage(Page.webComponentPageBuilder() .icon("font-awesome-regular:face-grin-tongue-wink") .title("Joke Log") .componentLink("qwc-jokes-log.js")); footerProducer.produce(footerPageBuildItem); } ```

3- Test the extension the see the correct behavior.
DevUI show the custom card.

image

4- Rename the artifactId in deployment/pom.xml by adding -test

<artifactId>hello-extension-test-deployment</artifactId>

5- Update the deployment configuration in runtime/pom.xml in consequences

<configuration>
    <deployment>${project.groupId}:${project.artifactId}-test-deployment:${project.version}</deployment>
</configuration>

6- Test again. The DevUI only shows the generated card. image

Output of uname -a or ver

Linux 5.10.16.3-microsoft-standard-WSL2 and NixOS 23.11 (unstable)

Output of java -version

openjdk version "17.0.7" 2023-04-18

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.2.2.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.6

Additional information

I am ready to contribute in order to resolve this issue but I will need some help to debug beceause I am new to Quarkus

quarkus-bot[bot] commented 1 year ago

/cc @cescoffier (devui), @phillip-kruger (devui)

gsmet commented 1 year ago

This happens when I change the deployment artifactID to something which is not following Quarkus convention (-deployment).

You shouldn't do that. The convention is important.

Vinetos commented 1 year ago

This happens when I change the deployment artifactID to something which is not following Quarkus convention (-deployment).

You shouldn't do that. The convention is important.

That is right but the configuration allows it.

eliottness commented 1 year ago

That right but the configuration allows it.

To elaborate a bit on @Vinetos, we migrated a internal multi-module dependency from been a normal dependency to being a quarkus extension. Back then, we only modified what was necessary to make it work which was to create a new deployment module and use a previous module as the runtime module. We knew of the convention, but did not feel pressured by it since everything seemed to be working as it should. This made place to a tree like this:

framework
├── framework-core        <- runtime extension artifact, old module
├── framework-deployment  <- deployment module, new module
├── framework-messaging   <- old module
[...]
└── framework-persistence <- old module

Naturally, we would have used the convention if this was a new project or if the documentation specified that this naming convention is mandatory.

gsmet commented 4 weeks ago

Sorry it took so long but I digged a bit more today and you're completely right that it actually shows an important issue in how we identify the extension for Dev UI elements.

We need to improve on that as the current coding is both brittle (as you experienced it) and quite inefficient.