vaadin / flow

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

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

Open taefi opened 4 months ago

taefi commented 4 months ago

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

mcollovati commented 4 months ago

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

taefi commented 4 months ago

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.

mshabarov commented 3 months ago

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.