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

vaadin-maven-plugin scans twice #21016

Open
jorgheymans opened this issue Feb 20, 2025 · 6 comments
Open

vaadin-maven-plugin scans twice #21016

jorgheymans opened this issue Feb 20, 2025 · 6 comments

Comments

@jorgheymans
Copy link

jorgheymans commented Feb 20, 2025

Description of the bug

A fresh app from start.vaadin.com gives this output:

mvn clean install -Pproduction
....
[INFO] >>> vaadin:24.6.5:prepare-frontend (default) > :configure @ my-app >>>
[INFO] 
[INFO] --- vaadin:24.6.5:configure (configure) @ my-app ---
[INFO] 
[INFO] <<< vaadin:24.6.5:prepare-frontend (default) < :configure @ my-app <<<
[INFO] 
[INFO] 
[INFO] --- vaadin:24.6.5:prepare-frontend (default) @ my-app ---
[INFO] Reflections took 1605 ms to scan 200 urls, producing 11676 keys and 60256 values
[INFO] The globally installed Node.js version 14.18.0 is older than the required minimum version 18.12.0. Using Node.js from /home/user/.vaadin.
[INFO] Visited 115 classes. Took 150 ms.
[INFO] Copying frontend resources from jar files ...
[INFO] Visited 178 resources. Took 143 ms.
[INFO] 
[INFO] >>> vaadin:24.6.5:build-frontend (default) > :configure @ my-app >>>
[INFO] 
[INFO] --- vaadin:24.6.5:configure (configure) @ my-app ---
[INFO] 
[INFO] <<< vaadin:24.6.5:build-frontend (default) < :configure @ my-app <<<
[INFO] 
[INFO] 
[INFO] --- vaadin:24.6.5:build-frontend (default) @ my-app ---
**[INFO] Scanning classes to find frontend configurations and dependencies...**
**[INFO] Visited 6509 classes. Took 3874 ms.**
[INFO] Checking if a production mode bundle build is needed
[INFO] A production mode bundle build is not needed
[INFO] Copying frontend resources from jar files ...
[INFO] Visited 178 resources. Took 76 ms.
**[INFO] Scanning classes to find frontend configurations and dependencies...**
**[INFO] Visited 6509 classes. Took 2704 ms.**
[INFO] Build frontend completed in 7080 ms.

-->
**[INFO] Visited 6509 classes. Took 3874 ms.**
**[INFO] Visited 6509 classes. Took 2704 ms.**

This was addressed in #19874 , but it seems to have come back?

Expected behavior

Class scanning occurs only once.

Minimal reproducible example

Helloworld from start.vaadin.com, with the streamlined vaadin-flow fixes https://vaadin.com/blog/streamlined-vaadin-flow-setup-for-v24.4

Versions

Latest helloworld from start.vaadin.com, Vaadin 24.6.5, spring-boot 3.4.2

@mcollovati
Copy link
Collaborator

#19874 focused on the "Reflections took 1157" part.
In build-frontend, the "Scanning classes ..." happens twice because it uses different scanners, one for "build" (whose implementation depends on the optimizeBundle setting) and the other for license checking.

We can check if it is possible to share the FrontendDependenciesScanner if the same implementation is used in both phases.

@jorgheymans
Copy link
Author

Thanks, on our 'big' project the difference is a bit more noticeable: first time 7.7s and second time 4.4s

.....
[ims] [INFO] --- vaadin:24.6.4:build-frontend (default) @ ims ---
[ims] [INFO] Scanning classes to find frontend configurations and dependencies...
[ims] [WARNING] Multiple npm versions for @vaadin/integer-field found:  [24.5.2, 24.6.3]. First version found '24.5.2' will be considered.
[ims] [WARNING] Multiple npm versions for @vaadin/polymer-legacy-adapter found:  [24.5.2, 24.6.3]. First version found '24.5.2' will be considered.
[ims] [INFO] Visited 7251 classes. Took 7742 ms.
[ims] [INFO] Checking if a production mode bundle build is needed
.....
[ims] [INFO] Running Vite ...
[ims] [INFO] Scanning classes to find frontend configurations and dependencies...
[ims] [WARNING] Multiple npm versions for @vaadin/integer-field found:  [24.5.2, 24.6.3]. First version found '24.5.2' will be considered.
[ims] [WARNING] Multiple npm versions for @vaadin/polymer-legacy-adapter found:  [24.5.2, 24.6.3]. First version found '24.5.2' will be considered.
[ims] [INFO] Visited 7251 classes. Took 4474 ms.

@mcollovati
Copy link
Collaborator

The upcoming Vaadin 24.6.6 release will contain one additional class scan improvement (#20978)

You can already try it by pinning Flow to 24.6.6 (add the flow-bom before the vaadin-bom), or please kindly wait for the release and report back if you cannot see any improvement.

@jorgheymans
Copy link
Author

Indeed, 24.6.6 seems to deliver a big improvement, that's great !

[ims] [INFO] Visited 2572 classes. Took 3508 ms.
...
[ims] [INFO] Visited 2572 classes. Took 2148 ms.

before:

[ims] [INFO] Visited 7251 classes. Took 7742 ms.
...
[ims] [INFO] Visited 7251 classes. Took 4474 ms.

@mstahv
Copy link
Member

mstahv commented Feb 20, 2025

Wouldn't this be solved by #20695 🤔

@mcollovati
Copy link
Collaborator

The double scan will be solved by #20695 only by disabling the license checking, that is not likely to be implemented.
The linked PR will, however, could potentially allow further reducing scan times by fine-tuning dependencies to scan

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

No branches or pull requests

3 participants