Vaadin 14

Learing about Vaadin 14 I created a project with SpringBoot, however the pom.xml is too large and the starting takes long time.
This is the pom.xml

<?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">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.qbex.jorge</groupId>
    <artifactId>atest</artifactId>
    <name>aTest</name>
    <version>2.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <vaadin.version>14.1.17</vaadin.version>

        <drivers.dir>${project.basedir}/drivers</drivers.dir>
        <drivers.downloader.phase>pre-integration-test</drivers.downloader.phase>
    </properties>

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

    <repositories>
        <!-- The order of definitions matters. Explicitly defining central here to make sure it has the highest priority. -->

        <!-- Main Maven repository -->
        <repository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <!-- Repository used by many Vaadin add-ons -->
        <repository>
            <id>Vaadin Directory</id>
            <url>https://maven.vaadin.com/vaadin-addons</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <!-- Main Maven repository -->
        <pluginRepository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-bom</artifactId>
                <version>${vaadin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <!-- Replace artifactId with vaadin-core to use only free components -->
            <artifactId>vaadin</artifactId>
            <exclusions>
                <!-- Webjars are only needed when running in Vaadin 13 compatibility mode -->
                <exclusion>
                    <groupId>com.vaadin.webjar</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.insites</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.polymer</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.polymerelements</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.vaadin</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.webcomponents</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-spring-boot-starter</artifactId>
            <exclusions>
                <!-- Excluding so that webjars are not included. -->
                <exclusion>
                    <groupId>com.vaadin</groupId>
                    <artifactId>vaadin-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-testbench</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <defaultGoal>spring-boot:run</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <!-- Clean build and startup time for Vaadin apps sometimes may exceed
                     the default Spring Boot's 30sec timeout.  -->
                <configuration>
                    <wait>300</wait>
                    <maxAttempts>240</maxAttempts>
                </configuration>
            </plugin>

            <!--
                Take care of synchronizing java dependencies and imports in
                package.json and main.js files.
                It also creates webpack.config.js if not exists yet.
            -->
            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>${vaadin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-frontend</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- Production mode is activated using -Pproduction -->
            <id>production</id>
            <properties>
                <vaadin.productionMode>true</vaadin.productionMode>
            </properties>

            <dependencies>
                <dependency>
                    <groupId>com.vaadin</groupId>
                    <artifactId>flow-server-production-mode</artifactId>
                </dependency>
            </dependencies>

            <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>build-frontend</goal>
                                </goals>
                                <phase>compile</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>integration-tests</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>start-spring-boot</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>start</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>stop-spring-boot</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Runs the integration tests (*IT) after the server is started -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <trimStackTrace>false</trimStackTrace>
                            <enableAssertions>true</enableAssertions>
                            <systemPropertyVariables>
                                <!-- Pass location of downloaded webdrivers to the tests -->
                                <webdriver.chrome.driver>${webdriver.chrome.driver}</webdriver.chrome.driver>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>com.lazerycode.selenium</groupId>
                        <artifactId>driver-binary-downloader-maven-plugin</artifactId>
                        <version>1.0.17</version>
                        <configuration>
                            <onlyGetDriversForHostOperatingSystem>true
                            </onlyGetDriversForHostOperatingSystem>
                            <rootStandaloneServerDirectory>
                                ${project.basedir}/drivers/driver
                            </rootStandaloneServerDirectory>
                            <downloadedZipFileDirectory>
                                ${project.basedir}/drivers/driver_zips
                            </downloadedZipFileDirectory>
                            <customRepositoryMap>
                                ${project.basedir}/drivers.xml
                            </customRepositoryMap>
                        </configuration>
                        <executions>
                            <execution>
                                <!-- use phase "none" to skip download step -->
                                <phase>${drivers.downloader.phase}</phase>
                                <goals>
                                    <goal>selenium</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>
</project>

This is the console startup

        _____             _   
  __ _ |_   _|  ___  ___ | |_ 
 / _` |  | |   / _ \/ __|| __|
| (_| |  | |  |  __/\__ \| |_ 
 \__,_|  |_|   \___||___/ \__|
                              

2020-02-25 16:43:34.431  INFO 19228 --- [  restartedMain]
 com.qbex.jorge.Application               : Starting Application on LFDC779RHR2 with PID 19228 (C:\SpringWs\atest\target\classes started by F6Z2C5A in C:\SpringWs\atest)
2020-02-25 16:43:34.433  INFO 19228 --- [  restartedMain]
 com.qbex.jorge.Application               : No active profile set, falling back to default profiles: default
2020-02-25 16:43:34.476  INFO 19228 --- [  restartedMain]
 .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-02-25 16:43:34.476  INFO 19228 --- [  restartedMain]
 .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-02-25 16:43:35.302  INFO 19228 --- [  restartedMain]
 o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2020-02-25 16:43:35.302  INFO 19228 --- [  restartedMain]
 o.apache.catalina.core.StandardService   : Starting service [Tomcat]

2020-02-25 16:43:35.302  INFO 19228 --- [  restartedMain]
 org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.27]

2020-02-25 16:43:35.853  INFO 19228 --- [  restartedMain]
 o.a.c.c.C.[Tomcat]
.[localhost]
.
[/]       : Initializing Spring embedded WebApplicationContext
2020-02-25 16:43:35.853  INFO 19228 --- [  restartedMain]
 o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1377 ms
2020-02-25 16:43:46.154  INFO 19228 --- [  restartedMain]
 c.v.f.s.VaadinServletContextInitializer  : Search for subclasses and classes with annotations took 10 seconds
2020-02-25 16:43:46.158  INFO 19228 --- [  restartedMain]
 c.v.f.server.startup.DevModeInitializer  : Starting dev-mode updaters in C:\SpringWs\atest folder.
2020-02-25 16:43:46.174  INFO 19228 --- [  restartedMain]
 dev-updater                              : Visited 94 classes. Took 16 ms.
2020-02-25 16:43:46.189  INFO 19228 --- [  restartedMain]
 dev-updater                              : Skipping `npm install`.
2020-02-25 16:43:46.189  INFO 19228 --- [  restartedMain]
 dev-updater                              : Copying frontend resources from jar files ...
2020-02-25 16:43:46.417  INFO 19228 --- [  restartedMain]
 dev-updater                              : Visited 12 resources. Took 220 ms.
2020-02-25 16:43:46.455  INFO 19228 --- [  restartedMain]
 dev-updater                              : No js modules to update 'C:\SpringWs\atest\target\frontend\generated-flow-imports.js' file
2020-02-25 16:43:52.621  INFO 19228 --- [  restartedMain]
 dev-webpack                              : Starting webpack-dev-server, port: 52855 dir: C:\SpringWs\atest
2020-02-25 16:43:52.628  INFO 19228 --- [  restartedMain]
 dev-webpack                              : Running webpack to compile frontend resources. This may take a moment, please stand by...
2020-02-25 16:44:08.872  INFO 19228 --- [  restartedMain]
 dev-webpack                              : Webpack startup and compilation completed in 16251ms
2020-02-25 16:44:09.286  INFO 19228 --- [  restartedMain]
 o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-02-25 16:44:09.499  INFO 19228 --- [  restartedMain]
 o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2020-02-25 16:44:09.684  INFO 19228 --- [  restartedMain]
 o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2020-02-25 16:44:09.684  INFO 19228 --- [  restartedMain]
 com.qbex.jorge.Application               : Started Application in 35.526 seconds (JVM running for 37.379)

Hi. The pom.xml size itself doesn’t have anything to do with the time it takes to start up the server in devmode. The current configuration is not minimal, but instead tries to be as informative as possible on what you should do to have a typical setup with some optimizations like the repository configuration and webjars exclusions.

There are some sections that are not “always” needed, like the integration test profile if you don’t write ITs. Was there some particular part that you are worried about ?

We are working on several improvements for the startup time for 14.2, and in some tests (on my machine ™) the first startup time for a spring-boot:run has reduced from 50-60s to 30-35s and recurring start is down to 5 seconds, for a simple project.
You can try 14.2.0.alpha5 but you’d need to add the Vaadin prereleases Maven repository configuration to the pom.xml, like it is done here https://github.com/vaadin/skeleton-starter-flow/blob/master/pom.xml#L32

Cheers