Vaadin 12 with Spring boot - production mode

Hi,

I’m trying to pacakage flow application based on spring boot for production (in single jar). Got it working in the debug mode, however when setting production mode to true I got error (vaadin.productionMode=true in application.properties):

“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’.”

I started from the sample: https://github.com/vaadin/flow-spring-tutorial
and changed the pom a bit (to get it working with flow 12) - attached. Any hints are welcomed.

build command: mvn clean package -PproductionMode spring-boot:repackage

17511119.xml (4.43 KB)

Apparantly resources have to be in:
src/main/resources/META-INF/resources/frontend

Also cleaned a pom and it’s working now. Not sure what did the trick. Working pom attached.

However I now see failed requests to fetch sw.js.

17511239.xml (4.36 KB)

Now it bottoms to the fact that css loaded with @import directive will fail to load:

Request URL: http://127.0.0.1:8080/frontend-es6/frontend/styles/colors.css - 404 not found

it is loaded from another css:

test.css:

@import url(“colors.css”);

.some_style {
padding: 1em;
}

@Route
@StyleSheet(“frontend://styles/test.css”)
public class MainView extends VerticalLayout {

public MainView(@Autowired MessageBean bean) {
	Button button = new Button("Click me",
			e -> Notification.show(bean.getMessage()));
	add(button);
}

}

I have reproducible example based on the starter project, if anyone is interested.

Goran, have you tried starting jetty in productionmode?

https://vaadin.com/docs/v11/flow/production/tutorial-production-mode-basic.html

That yields (mvn jetty:run):

[INFO]
Logging initialized @89435ms to org.eclipse.jetty.util.log.Slf4jLog
[INFO]

[INFO]
BUILD FAILURE
[INFO]

[INFO]
Total time: 01:28 min
[INFO]
Finished at: 2019-02-12T11:54:19+01:00
[INFO]

[ERROR]
Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:9.4.12.v20180830:run (default-cli) on project my-starter-project: Unable to parse configuration of mojo org.eclipse.jetty:jetty-maven-plugin:9.4.12.v20180830:run for parameter resourceBases: Cannot set ‘resourceBases’ in class org.eclipse.jetty.maven.plugin.JettyWebAppContext: InvocationTargetException: NullPointerException → [Help 1]

No luck with css with jar also. 404…
Same with deployment on Tomcat.

Also, that sample suggest running mvn jetty:run -Pproduction-mode, that is not what people usually want (you don’t want to build SW in deployment).