flow icon indicating copy to clipboard operation
flow copied to clipboard

Having a Vaadin application built for production as a dependency forces production mode to the main application at development time

Open taefi opened this issue 1 year ago • 2 comments
trafficstars

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

  1. Download and build a starter application in production mode.
  2. Use it as the dependency in another Vaadin application (main application).
  3. Run the main application from the main class or from command line without specifying the production flag.
  4. 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.

taefi avatar Mar 07 '24 14:03 taefi

There is a mention of this situation in the Troubleshooting section of the documentation.

mcollovati avatar Mar 07 '24 14:03 mcollovati

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.

taefi avatar Mar 11 '24 08:03 taefi

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.

mshabarov avatar Mar 19 '24 11:03 mshabarov