vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
621 stars 167 forks source link

during a maven build, reflections is invoked several times #20385

Open jorgheymans opened 2 weeks ago

jorgheymans commented 2 weeks ago

Description of the bug

Even though https://github.com/vaadin/flow/issues/19874 greatly improved things, each invocation of the vaadin maven plugin seems to still scan the classpath - according to the log output:

 [INFO] --- vaadin:24.5.2:prepare-frontend (default) @ ims ---
 [INFO] Reflections took 1624 ms to scan 320 urls, producing 17948 keys and 94028 values
 .....
 [INFO] 
 [INFO] >>> vaadin:24.5.2:build-frontend (default) > :configure @ ims >>>
 --- vaadin:24.5.2:configure (configure) @ ims ---
 [INFO] Reflections took 1712 ms to scan 320 urls, producing 17948 keys and 94028 values 
 ......
 [INFO] 
 [INFO] <<< vaadin:24.5.2:build-frontend (default) < :configure @ ims <<<
 [INFO] 
 [INFO] --- vaadin:24.5.2:build-frontend (default) @ ims ---
 [INFO] Reflections took 1341 ms to scan 320 urls, producing 17948 keys and 94028 values
 .....

Expected behavior

Ideally the classpath is scanned only once

Minimal reproducible example

A normal maven build of any vaadin project

Versions

Vaadin 24.5.2

mcollovati commented 2 weeks ago

The main reason for that is that prepare-frontend and build-frontend can run on different phases, so having different "class path". ClassFinder is now per mojo instances We can check if it is possible to cache per execution phase.

~Another thing that should be investigated is why build-frontend is reported twice~ Never mind. The additional ClassFinder is because of the configure goal