Building Production version fails, building for development works fine

Dev build works: mvnw clean package -Pdevelopment

Prod build fails: mvnw clean package -Pproduction -X

It’s a 100% Flow app, no Hilla

A bit of POM:

    <properties>
        <java.version>21</java.version>
        <vaadin.version>24.8.5</vaadin.version>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.5.3</version>
    </parent>
...

 <plugin>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-maven-plugin</artifactId>
    <version>24.7.6</version>
    <executions>
        <execution>
            <id>frontend</id>
            <phase>compile</phase>
            <goals>
                <goal>prepare-frontend</goal>
                <goal>build-frontend</goal>
            </goals>
        </execution>
    </executions>
</plugin>

A bit of the log

[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:24.7.6:prepare-frontend (frontend) on project tendernisse: null: MojoFailureException: InvocationTargetException: com/vaadin/hilla/engine/EngineConfiguration$Builder: com.vaadin.hilla.engine.EngineConfiguration$Builder -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.vaadin:vaadin-maven-plugin:24.7.6:prepare-frontend (frontend) on project tendernisse: null
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
 
... ending in 

Caused by: java.lang.ClassNotFoundException: com.vaadin.hilla.engine.EngineConfiguration$Builder
    at jdk.internal.loader.BuiltinClassLoader.loadClass (BuiltinClassLoader.java:641)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:526)
    at com.vaadin.flow.plugin.maven.Reflector$CombinedClassLoader.loadClass (Reflector.java:392)
    at com.vaadin.hilla.maven.Configurable.configure (Configurable.java:40)
    at com.vaadin.hilla.maven.PrepareFrontendMojo.executeInternal (PrepareFrontendMojo.java:49)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at com.vaadin.flow.plugin.maven.FlowModeAbstractMojo.execute (FlowModeAbstractMojo.java:306)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)

Vaadin version and Maven Plugin MUST be in sync

2 Likes

Makes sense, I just removed the plugin from the POM, since there is no version 24.8.5

What? Removed? Without the plugin, you can’t build production mode :sweat_smile:

The version 24.8.5 should be available Maven Central: com.vaadin:vaadin-maven-plugin

You are right, I couldn’t get it loaded inside IntelliJ, so I just tested the difference and it compiled, but it will not run of course.

I’m not really sure why, but I cleaned a lot of stuff and now it compiles in production mode too.

Thanx