flow icon indicating copy to clipboard operation
flow copied to clipboard

There should be a way to include test sources in the build frontend classpath scanner

Open Artur- opened this issue 2 years ago • 0 comments

Description of the bug

If you build an addon you might set up the project so that you have the addon in src/main/java and a test application in src/test/java. If you test your application in production mode, i.e. build using vaadin:build-frontend, all your JS/TS dependencies will end up in the fallback bundle. This is probably because of how the class scanner classpath is generated in https://github.com/vaadin/flow/blob/7866181350f172bdc833c789fd93953306d90e14/flow-plugins/flow-maven-plugin/src/main/java/com/vaadin/flow/plugin/maven/FlowModeAbstractMojo.java#L235-L239 ignoring the test classpath. In normal cases this is how it should be done but there should be a way to include the test classpath also. Jetty for instance has

<useTestScope>true</useTestScope>

for this purpose, and this is what you would use in your addon project

Expected behavior

The JS modules of a project does not go into the fallback bundle even when the app sources are in the test folder

Minimal reproducible example

https://github.com/samie/specialbuttons/commit/571832b121b86653f87c02740a0d3e7e6134eede

Versions

  • Vaadin / Flow version: 14.8.18

Same code is in Vaadin 23.2

Artur- avatar Oct 05 '22 07:10 Artur-