Search code examples
javavaadinmode

Vaadin: Can't build on production mode


I try to put my app in production mode, I'm on vaadin flow 14.1.5, the profile is already on the pom.xml.

production profile on the pom.xml is like this:

<build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <jvmArguments>-Dvaadin.productionMode</jvmArguments>
                    </configuration>
                </plugin>
                <plugin>
                        <groupId>com.vaadin</groupId>
                        <artifactId>vaadin-maven-plugin</artifactId>
                        <version>${vaadin.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>prepare-frontend</goal>
                                <goal>build-frontend</goal>
                            </goals>
                            <phase>compile</phase>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>

However when running on the terminal: mvn clean package -P production

I got this:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.437 s
[INFO] Finished at: 2020-04-25T00:22:09-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:14.1.5:build-frontend (default) on project project-maya: Execution default of goal com.vaadin:vaadin-maven-plugin:14.1.5:build-frontend failed: Unsupported class file major version 58 -> [Help 1]

I'm on testing at the moment so I don't really care about running on development mode but I will be running on production mode soon and I really don't know what to do to fix this.


Solution

  • Edit: Vaadin 14.1.26 has now been released, which includes the fix for not being able to build with Java 14 (Flow issue #7918).


    This is most likely an issue with Java 14.

    There's a fix in Flow version 2.1.9 and 2.2.0.beta2.

    Vaadin 14.1.25 still uses 2.1.8, hopefully there will be a new version with 2.1.9 soon.

    Vaadin 14.2.0.beta1 uses 2.2.0.beta2, so if you want you could try that.

    Hopefully the fix is available in a stable release once you need production mode to work.