Unable to run production fat-jar

So i created an App with https://vaadin.com/start/latest (used the spring-boot version, and added two pages to it).

then i used mvn clean package -Pproduction (from https://vaadin.com/docs/v14/flow/production/tutorial-production-mode-basic.html) to create a production fat-jar

and then i started that jar with java -jar example-project-2.0-SNAPSHOT.jar

and that results in
java.lang.IllegalStateException: Failed to update the Flow imports file '[....] \target\frontend\generated-flow-imports.js'

Caused by: java.lang.IllegalStateException:

  Failed to find the following css files in the 'node_modules' or '[....]
\.\frontend' directory tree:
      - styles/views/masterdetail/master-detail-view.css
      - styles/views/dashboard/dashboard-view.css

so these css files are missing in the frontend folder of the jar and apparently they do not get copied when creating the jar file ( i looked into the jar and they are missing there).

so what I’m doing wrong here ?

Looks jar is execute in dev mode.
Was it build in production mode ?
There was a bug which is fixed in the latest version and allows to execute jar in dev mode as well.
And there was another bug with wrong mode detection of jar file.
Both bugs should be fixed in the latest version.

But if your jar is build using produciton mode you may use vaadin.productionMode system property to run tha jar.


java -Dvaadin.productionMode=true -jar example-project-2.0-SNAPSHOT.jar

Roland de Grabla-Mściszewski:

java -Dvaadin.productionMode=true -jar example-project-2.0-SNAPSHOT.jar

Thanks thats the solution, forgot that.