Vaadin 14 Deployment in Tomcat

Hallo guys,

I have upgraded my project to Vaadin 14. I am using Spring Boot 2.3 with Vaadin 14.
I have got two issues in this new version:

  1. Running the project takes very very long time(approximately 2 minutes). I have to wait for 2 minutes everytime I want to see the changes in browser. My project is totally backend, nothing to do with javascript or css. Can we disable building these frontend things so that it does not build everytime I build the project.
  2. Deploying the project I have built the war file using gradle build command. It generates war file which I want to deploy into the tomcat server(running in docker container). Unfortunately, I got the following error message:
Vaadin requires node.js & npm to be installed. Please install the latest LTS version of node.js (with npm) either by:
1) following the https://nodejs.org/en/download/ guide to install it globally. This is the recommended way.
2) running the following Maven plugin goal to install it in this project:
$ mvn com.github.eirslett:frontend-maven-plugin:1.7.6:install-node-and-npm -DnodeVersion="v12.14.0"

Note that in case you don't install it globally, you'll need to install it again for another Vaadin project.
In case you have just installed node.js globally, it was not discovered, so you need to restart your system to get the path variables updated.

I don’t undestand why the packaged war file still needs npm or nodejs. Also there is no possibilities to install npm or nodejs in my Tomcat Server which is running in a container.

I am disperately waiting for the solution for these issues for my project deployment.

Thanks.

Krishna

Finally, I could workaround these issues.

  1. This issue was solved by activating gradle caching i.e. I place
    org.gradle.caching=true
    in gradle.properties file.

  2. I could figure out this problem by using vaadin gradle plugin.
    https://github.com/vaadin/vaadin-gradle-plugin

    In my jenkin, I provided following build command for deploying as a production mode:
    gradle clean vaadinPrepareNode build -Pvaadin.productionMode

    Here, vaadinPrepareNode actually installs npm and nodejs locally in the project, so that we don’t need to install in the container itself.

    There is a sample application to start Vaadin 14 with spring boot using gradle build tool.
    https://github.com/vaadin/base-starter-spring-gradle

    Note: In case any peculiar problem related to node or webpack comes, then simply remove the package.json, package-lock.json, weback.config.json, and webpack.generated.js files, and rebuild,