Skip to content
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

feat: added codestart #119

Merged
merged 2 commits into from
May 10, 2023
Merged

feat: added codestart #119

merged 2 commits into from
May 10, 2023

Conversation

mcollovati
Copy link
Contributor

Description

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

Closes #112

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

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

Closes #112
@mcollovati mcollovati marked this pull request as ready for review May 5, 2023 12:24
@mcollovati
Copy link
Contributor Author

mcollovati commented May 5, 2023

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
Copy link
Contributor

czp13 commented May 10, 2023

Executed with mvn -Pproduction package

  • and got some errors like:
[ERROR] Error fetching link: /Users/pczuczor/Projects/quarkus/integration-tests/reusable-theme/target/apidocs. Ignored it.
[ERROR] Error fetching link: /Users/pczuczor/Projects/quarkus/integration-tests/test-addons/addon-with-jandex/target/apidocs. Ignored it.
[ERROR] Error fetching link: /Users/pczuczor/Projects/quarkus/integration-tests/test-addons/addon-without-jandex/target/apidocs. Ignored it.
[ERROR] Error fetching link: /Users/pczuczor/Projects/quarkus/integration-tests/custom-websocket-dependency/target/apidocs. Ignored it.

Probably expected some kind of documentation in multiple places, but eventually, the build got green.

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:

  • mvn clean install
  • mvn package

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
  1. cd getting-started
  2. 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.

Copy link
Contributor

@czp13 czp13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Reviewed the code
  • And executed the commands, build the jars, tested both production and dev mode.

After some initial confusion, both work fine for me.

Only notes:

  • Errors for missing apidocs while building (exceptions above)
  • readme.MD could be updated how to properly buid/run app:
    • commands, paths for dev an production profiles.

@sonarcloud
Copy link

sonarcloud bot commented May 10, 2023

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
Copy link
Contributor Author

  • in the add-on codebase, production profile is not defined. You can find it in the project generated by quarkus maven plugin
  • javadocs error messages, are expected as the mentioned modules are only used for tests. We can probably set the skip flag
  • temporary directory is any directory on the file system, it is not related to the add-on project
  • I tested project creation again and cannot see the Read Timeout errors

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

@mcollovati mcollovati merged commit ca13046 into master May 10, 2023
@mcollovati mcollovati deleted the issues/112_codestart branch May 10, 2023 13:45
mcollovati added a commit that referenced this pull request May 10, 2023
Added a codestart that provides a Flow application with an example view

Closes #112
Co-authored-by: Peter Czuczor <[email protected]>
czp13 pushed a commit that referenced this pull request May 15, 2023
Added a codestart that provides a Flow application with an example view.
Closes #112
@vaadin-bot
Copy link

Hi @mcollovati and @mcollovati, when i performed cherry-pick to this commit to 1.1, i have encountered the following issue. Can you take a look and pick it manually?
Error Message:
Error: Command failed: git cherry-pick ca13046
error: could not apply ca13046... feat: added codestart (#119)
hint: After resolving the conflicts, mark them with
hint: "git add/rm ", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".

@mcollovati
Copy link
Contributor Author

Was already picked manually

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a codestart for the extension
3 participants