vaadin / quarkus

An extension to Quarkus to support Vaadin Flow
Apache License 2.0
28 stars 3 forks source link

feat: added codestart #119

Closed mcollovati closed 1 year ago

mcollovati commented 1 year ago

Description

Added a codestart that provides a Flow application with an example view

Closes #112

Type of change

Checklist

Additional for Feature type of change

mcollovati commented 1 year ago

To test, after building locally the extension, in a temporary directory run

mvn io.quarkus.platform:quarkus-maven-plugin:3.0.1.Final:create \
 -DprojectGroupId=org.acme -DprojectArtifactId=getting-started \
 -Dextensions='com.vaadin:vaadin-quarkus:2.0-SNAPSHOT' -DwithCodestart \
 -Ddata="vaadin-flow-codestart.vaadinVersion=24.0.5"

The command will create a Quarkus based Vaadin application, that can be launched in dev mode with mvn quarkus:dev and in production mode with mvn -Pproduction package and java -jar target/quarkus-app/quarkus-run.jar

The vaadin-flow-codestart.vaadinVersion property can also be set to use a snapshot (e.g. 24.1-SNAPSHOT); in this case the Vaadin pre-release repositories are added to the pom file.

czp13 commented 1 year ago

Executed with mvn -Pproduction package

In the end got this mesage:

[WARNING] The requested profile "production" could not be activated because it does not exist.

Also did not see in the root pom.xml Should we add the production profile there, or it is looking somewhere

Also tried to just run in the root:

Did not get the temporary director...

Update, ok, I got lost :).

Start in a different way now:

  1. mvn clean install
  2. cd runtime/target (temp directory I guess) (Getting the Error fetching link errors shared above, I think these are cosmetic or would be nice to have notifications/errors)
  3. there:
    mvn io.quarkus.platform:quarkus-maven-plugin:3.0.1.Final:create \
    -DprojectGroupId=org.acme -DprojectArtifactId=getting-started \
    -Dextensions='com.vaadin:vaadin-quarkus:2.0-SNAPSHOT' -DwithCodestart \
    -Ddata="vaadin-flow-codestart.vaadinVersion=24.0.5"

    Result:

    [INFO] 📚 java
    🔨 maven
    📦 quarkus
    📝 config-properties
    🔧 dockerfiles
    🔧 maven-wrapper
    🚀 vaadin-flow-codestart
    [INFO]
    -----------
    [SUCCESS] ✅  quarkus project has been successfully generated in:
    --> /Users/pczuczor/Projects/quarkus/runtime/target/getting-started
  4. cd getting-started
  5. mvn quarkus:dev

After a couple of:

Press [r] to re-run, [o] Toggle test output, [:] for the terminal, [h] for more options>

Quarkus DEV UI is running: image

First getting some Read timeout exceptions (maybe my laptop is slow):

2023-05-10 13:26:10,696 INFO  [com.vaa.qua.QuarkusInstantiator] (executor-thread-1) Can't find any @VaadinServiceScoped bean implementing 'I18NProvider'. Cannot use CDI beans for I18N, falling back to the default behavior.

2023-05-10 13:28:36,181 ERROR [com.vaa.flo.ser.DefaultErrorHandler] (executor-thread-2) : java.io.IOException: Read timeout
    at io.undertow.vertx.VertxHttpExchange.readBlocking(VertxHttpExchange.java:505)

But eventually, Vaadin App is also running, and reachable: image

  1. mvn -Pproduction package works as well, creating the jar without any error! 🎉

  2. java -jar target/quarkus-app/quarkus-run.jar Works too, application is reachable on: http://localhost:8080/ in my case.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

mcollovati commented 1 year ago

For the notes, it may be worth creating some tickets, as they are not strictly related to the changes in this PR