On development mode and production mode

Hi,

I am seeing developers building their Vaadin application locally in production mode, in order to verify the packaging and spring-boot configuration processing etc. So they execute mvn -Pproduction clean install. Once done, they go back to IntelliJ - using the Vaadin plugin - and do ‘Debug using HotswapAgent’. But when the application then starts, it is started in production mode, as can be seen in the logs.

Is this intended ? It seems that to be able to restart in development mode, mvn com.vaadin:vaadin-maven-plugin:24.6.5:dance is needed first. Would it make sense that the IntelliJ plugin does the necessary behind the scenes instead to ensure that the application is started in development mode? Adding to the confusion sometimes, hotswapping java classes does work like that in production mode, but not hotswapping css.

I’m trying to distill a uniform developer workflow out of all this, so that when they get stuck with hotswap they can drag themselves out. To that extent, the full page refresh that used to happen when reloading code was a great indicator that things were working.

1 Like

Actually, this should have been fixed by fix: remove tokenFile after production build by caalador · Pull Request #20346 · vaadin/flow · GitHub

If the issue is still there, it deserves a new ticket. Maybe the cause is different now

I did a quick test with Vaadin 24.6.5.

  • Started application from IDE and got Vaadin is running in DEVELOPMENT mode - do not use for production deployments
  • Built for production mvn package -Pprodcution
  • Started the application from JAR and got Vaadin is running in production mode.
  • Started application from IDE again (no clean actions performed) and got `Vaadin is running in DEVELOPMENT mode - do not use

Thanks for doing a test.

Looking closer, I think the issue is with mvnd , which keeps maven instances around for faster startup. Those jvm’s don’t exit, hence the file is not deleted.

There may be other scenario’s where the tokenfile (flow-build-info.json) is present when the intelliJ plugin executes. Perhaps it should just attempt to detect and remove it before it runs?

Do you mind creating a ticket for this case where JVM does not exit?
Perhaps this can be fixed in the maven plugin itself, by forcing the file deletion in a try/finally block instead of using the deleteOnExit method.

Thanks, consider alternative strategy for removing the tokenfile in maven plugin · Issue #21021 · vaadin/flow · GitHub created !

1 Like