Closed mmirwaldt closed 4 years ago
I discovered that target/frontend/generated-flow-imports.js references those missing js modules under npm_modules/@vaadin/flow-frontend/ :
...
import '@vaadin/flow-frontend/flow-component-renderer.js';
import '@vaadin/flow-frontend/gridConnector-es6.js';
import '@vaadin/flow-frontend/vaadin-grid-flow-selection-column.js';
import '@vaadin/flow-frontend/contextMenuConnector-es6.js';
...
import '@vaadin/flow-frontend/gridConnector.js';
import '@vaadin/flow-frontend/contextMenuConnector.js';
Shouldn't it be:
...
import 'frontend://flow-component-renderer.js';
import 'frontend://gridConnector-es6.js';
import 'frontend://vaadin-grid-flow-selection-column.js';
import 'frontend://contextMenuConnector-es6.js';
...
import 'frontend://gridConnector.js';
import 'frontend://contextMenuConnector.js';
Then it would reference to the frontend folder under META-INF/resources/frontend according to this post
I discovered that #5632 tried to introduce it but broke it.
I found a workaround: I copied all files from META-INF/resources/frontend to npm_modules/@vaadin/flow-frontend/. That works.
Changing target/frontend/generated-flow-imports.js does not work because it is overwritten with every restart.
I opened a discussion in the forum https://vaadin.com/forum/thread/17871763 . I am not sure whether this issue is a ticket or a discussion in the forum.
@mmirwaldt Before packaging the fat jar, did you run vaadin:prepare-frontend
(this goal is missing from the pom.xml
but I do not know what is in the parent)? Also, how do you run the fat jar?
I was able to start the application without npm errors with the pom.xml
above as follows:
mvn -Pproduction vaadin:prepare-frontend package
java -jar target/webapp-0.0.1-SNAPSHOT.jar
@joheriks The parent is just a pom listing the modules my project has. Nothing special. My vaadin webapplication is a separate module in the profile webapp.
Here is it: `<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>net.mirwaldt</groupId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<artifactId>net.mirwaldt.***</artifactId>
<name>***</name>
<description>***</description>
<url>***</url>
<modules>
<module>core</module>
<module>core-demos</module>
<module>object</module>
<module>object-demos</module>
<module>data</module>
</modules>
<profiles>
<profile>
<id>webapp-demo
</id>
<modules>
<module>webapp</module>
</modules>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.0.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
`
I run the fat jar as a service on my centos 7 server without maven.
I changed the goal to "prepare-frontend" in the vaadin-maven-plugin and will try it out soon. I will answer here again if it worked.
@mmirwaldt did it work for you?
I am facing the same problem. I already tried
mvn -Pproduction vaadin:prepare-frontend package
suggested by @joheriks , but running the app fails like before.
@mmirwaldt Could you run the fat jar or do you still experience the same issue efter running
@polishcode Can you provide a minimal self-contained example that exposes the issue?
I have tried out and it does not work.
I get "Failed to find the bundle manifest file 'frontend://vaadin-flow-bundle-manifest.json' in the servlet context for 'ES6' browsers. If you are running a dev-mode servlet container in maven e.g. jetty:run
change it to jetty:run-exploded
. If you are not compiling frontend resources, include the 'vaadin-maven-plugin' in your build script. Otherwise, you can skip this error either by disabling production mode, or by setting the servlet parameter 'original.frontend.resources=true'."
Even setting original.frontend.resources=true in application.properties or in system properties does not work. :-(
I could solve that problem by adding the system property vaadin.original.frontend.resources=true . I don't know why but setting both goals
<goal>build-frontend</goal>
seems to solve the problem.
vaadin-flow-bundle-manifest.json
file and vaadin.original.frontend.resources
make sense and do something only in compatibility mode.
So apparently you are running the app in compatibility mode.
The original reports was about NPM mode.
Also the original report is about dev mode since you should not have any dev-updater
errors in production mode.
Just ti clarify: to be able to run you app in production mode you should:
production
profile which also can be activated via vaadin.productionMode
property)vaadin.productionMode
system property (or application property in Spring) or productionMode
init parameter (for servlet).Also please note that there is https://github.com/vaadin/flow/issues/6657. Which is about running fat jar in dev mode without need to specify production mode property explicitly.
@mmirwaldt #6657 and some other issues related to fat jar have been recently fixed. Would you please try Vaadin 14.0.13 and see if your problem is resolved?
Closing the issue as it probably has been fixed, but there has not been a response from the author in a reasonable time. If the issue is still valid, please reopen with instructions on how to reproduce.
I can run my vaadin application from IntelliJ IDE but not from console as fat jar. What I use:
I get the following error:
My pom.xml (the *** in artifact id in the parent tag are a real name. I must hide it here ;-) :
I see that the folder npm_modules/@vaadin/flow-frontend is empty but the missing js-files are in the fatjar under META-INF/resources/frontend:
Removing
didn't help. It always runs in the same error and cannot build the frontend. What''s going wrong? How can I fix it? Is there a workaround?