Production mode build

Hello.
According to latest documentation https://vaadin.com/docs/latest/flow/production/production-build#excluding-development-server-module to exclude development server module I have to add in production profile:

<exclusions>
    <exclusion>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-dev</artifactId>
     </exclusion>
</exclusions>

But this module still gets into the assembly. Is this how it should be?

How does your maven promt looks like for building productive?

It is command line which executed:

cd C:\work\online; JAVA_HOME=C:\\jdk-17 cmd /c "\".\\mvnw.cmd\" -DskipTests=true -Dmaven.ext.class.path=C:\\dev\\netbeans23\\java\\maven-nblib\\netbeans-eventspy.jar -Dmaven.javadoc.skip=true -Pproduction clean install"

Try to run

mvn dependency:tree -Pproduction -Dincludes=com.vaadin:vaadin-dev

and check which artifact has a dependency to vaadin-dev.

This is result:

[INFO] org.mycompany:online:war:1.0-SNAPSHOT
[INFO] \- com.vaadin:vaadin-core:jar:24.4.13:compile
[INFO]    \- com.vaadin:vaadin-dev:jar:24.4.13:compile

The documentation assumes the project has a com.vaadin:vaadin dependency, but in you have com.vaadin:vaadin-core because you are not using commercial components.
Just add the exclusion to that vaadin-core

That’s exactly what I have. My production profile:

       <profile>
            <id>production</id>
            <properties>
                <log.file>online.log</log.file>
                <log.level>INFO</log.level>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.vaadin</groupId>
                        <artifactId>vaadin-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>clean-frontend</goal>
                                    <goal>build-frontend</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <productionMode>true</productionMode>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>com.vaadin</groupId>
                                <artifactId>vaadin-core</artifactId>
                                <version>${vaadin.version}</version>
                                <exclusions>
                                    <exclusion>
                                        <groupId>com.vaadin</groupId>
                                        <artifactId>vaadin-dev</artifactId>
                                    </exclusion>
                                </exclusions>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>

The dependency should be defined at the profile level, not as a plugin configuration.
If you look at the example in the documentation there is this comment

 <!-- above production build configuration -->
      <profile>
            <id>production</id>
            <properties>
                <log.file>online.log</log.file>
                <log.level>INFO</log.level>
            </properties>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin</artifactId>
                <exclusions>
                    <exclusion>
                        <groupId>com.vaadin</groupId>
                        <artifactId>vaadin-dev</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>
       <build> ..... </build>
1 Like

Thanks Marco! You are right, my mistake. Tough week. :face_with_diagonal_mouth:

1 Like