flow
flow copied to clipboard
Having a Vaadin application built for production as a dependency forces production mode to the main application at development time
Description of the bug
Having a Vaadin application built for production as a dependency forces production mode to the main application at development time. It seems that the DefaultApplicationConfigurationFactory causes a leakage of build info token from the dependencies available in the classpath.
Developing Hilla applications, it can happen that another Hilla application containing endpoints could be reused as a dependency (even thought the reusable part could be only the endpoints).
Workaround
Creating a separate build of the dependency without production flag alleviates the issue.
Expected behavior
The productionMode value of the build info token from a dependency should not be taken into account when running the main application in development mode.
Minimal reproducible example
- Download and build a starter application in production mode.
- Use it as the dependency in another Vaadin application (main application).
- Run the main application from the main class or from command line without specifying the
productionflag. - You should be able to spot the log saying "Vaadin is running in production ..."
Versions
- Vaadin / Flow version: tested with 24.4 but it can happen in earlier versions as well.
There is a mention of this situation in the Troubleshooting section of the documentation.
Just mentioning it here for future references:
Another issue I faced is that having a dependency in the classPath that contains a flow-build-info.json can mess with finding the themes folder under frontend directory as well, since when the dependency project is built without the production flag set, there is an entry for "frontendFolder" which is referring to the paths of the dependency project.
Thanks for the hint @mcollovati. I could workaround the issue by excluding the build info from the dependency jar file.
The described behaviour is by design and documented. Token file should be excluded in the add-on project. I'd suggest to preserve this issue in the issue tracker, but make it as enhancement for future improvements.