0

I am trying Vaadin 8 to 14 MPR migration for which I have built a simple application which disaplys components created in Vaadin 8 and after migration to 14, I have to show them in UI.

During the Frontend compilation, I get errors as below

ERROR in ../target/flow-frontend/Flow.js
Module not found: Error: Can't resolve '@vaadin/common-frontend' in 'C:\Vaadin14\VaadinMPR\vadin-8-to-14-mpr-ui\target\flow-frontend'
 @ ../target/flow-frontend/Flow.js 1:0-79 77:60-75 260:8-27 270:52-67 274:56-71 277:56-71 284:52-67
 @ ../target/index.ts
 @ ./generated/vaadin.ts

ERROR in ../target/frontend/generated-flow-imports.js
Module not found: Error: Can't resolve '@vaadin/flow-frontend/ConnectionIndicator.js' in 'C:\Vaadin14\VaadinMPR\vadin-8-to-14-mpr-ui\target\frontend'
 @ ../target/frontend/generated-flow-imports.js 11:0-54
 @ ../target/index.ts
 @ ./generated/vaadin.ts

ERROR in ../target/flow-frontend/VaadinDevmodeGizmo.js
Module not found: Error: Can't resolve 'lit' in 'C:\Vaadin14\VaadinMPR\vadin-8-to-14-mpr-ui\target\flow-frontend'
 @ ../target/flow-frontend/VaadinDevmodeGizmo.js 7:0-53 123:40-50 144:15-18 1143:19-22 1146:19-22 1149:19-22 1152:19-22 1155:19-22 1160:15-19 1170:38-42 1172:14-18 1176:14-18 1190:15-19 1196:35-39 1224:86-93 1233:14-18 1254:14-18 1276:31-35 1276:108-115 1280:15-19 1292:15-19 1332:15-19 1337:39-43 1373:30-33 1374:31-34 1375:30-33 1376:32-35 1377:29-32

ERROR in ../target/flow-frontend/VaadinDevmodeGizmo.js
Module not found: Error: Can't resolve 'lit/decorators.js' in 'C:\Vaadin14\VaadinMPR\vadin-8-to-14-mpr-ui\target\flow-frontend'
 @ ../target/flow-frontend/VaadinDevmodeGizmo.js 8:0-59 1393:4-12 1396:4-12 1399:4-12 1402:4-12 1405:4-12 1408:4-12 1411:4-12 1414:4-12 1417:4-12 1420:4-12 1423:4-9 1426:4-9 1429:4-9 1432:4-9 1435:4-9 1438:4-9

ERROR in ../target/flow-frontend/VaadinDevmodeGizmo.js
Module not found: Error: Can't resolve 'lit/directives/class-map.js' in 'C:\Vaadin14\VaadinMPR\vadin-8-to-14-mpr-ui\target\flow-frontend'
 @ ../target/flow-frontend/VaadinDevmodeGizmo.js 9:0-55 1197:24-32
Child HtmlWebpackCompiler:
     1 asset
    Entrypoint HtmlWebpackPlugin_0 = __child-HtmlWebpackPlugin_0
    [../node_modules/.pnpm/html-webpack-plugin@4.5.1_webpack@4.46.0/node_modules/html-webpack-plugin/lib/loader.js!../target/index.html] 1.17 KiB {HtmlWebpackPlugin_0} [built]
i 「wdm」: Failed to compile.

------------------ Frontend compilation failed. ------------------

Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\DumpStack.log.tmp'

Here is my 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>org.example</groupId>
    <artifactId>vadin-8-to-14-mpr-ui</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>vadin-8-to-14-mpr-ui</name>

    <prerequisites>
        <maven>3</maven>
    </prerequisites>

    <properties>
    <!--    <vaadin.version>8.9.4</vaadin.version>-->
        <vaadin.version>14.8.0</vaadin.version>
        <vaadin.plugin.version>8.9.4</vaadin.plugin.version>
        <jetty.plugin.version>9.4.43.v20210629</jetty.plugin.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <!-- If there are no local customizations, this can also be "fetch" or "cdn" -->
        <vaadin.widgetset.mode>local</vaadin.widgetset.mode>
    </properties>

    <repositories>
        <repository>
            <id>vaadin-addons</id>
            <url>http://maven.vaadin.com/vaadin-addons</url>
        </repository>
    </repositories>

    <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>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-server</artifactId>
            <version>8.13.3</version>
            <exclusions>
                <exclusion>
                    <groupId>org.jsoup</groupId>
                    <artifactId>jsoup</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.gwt</groupId>
                    <artifactId>gwt-elemental</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-push</artifactId>
            <version>8.13.3</version>
        </dependency>
    <!--    <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client-compiled</artifactId>
        </dependency>-->
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-themes</artifactId>
            <version>8.7.0</version>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-core</artifactId>
            <version>14.8.0</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>mpr-v8</artifactId>
        </dependency>
        <!-- External dependencies-->
        0
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>flow-server</artifactId>
            <version>6.0.4</version>
        </dependency>
    
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>flow-client</artifactId>
            <version>9.0.2</version>
        </dependency>

        

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <!-- Exclude an unnecessary file generated by the GWT compiler. -->
                    <packagingExcludes>WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>${vaadin.plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>update-theme</goal>
                            <goal>update-widgetset</goal>
                            <goal>compile</goal>
                            <!-- Comment out compile-theme goal to use on-the-fly theme compilation -->
                            <goal>compile-theme</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>flow-maven-plugin</artifactId>
                <version>2.0.7</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-frontend</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.0.0</version>
                <!-- Clean up also any pre-compiled themes -->
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>src/main/webapp/VAADIN/themes</directory>
                            <includes>
                                <include>**/styles.css</include>
                                <include>**/styles.scss.cache</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>

            <!-- The Jetty plugin allows us to easily test the development build by
                running jetty:run on the command line. -->
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.plugin.version}</version>
                <configuration>
                    <scanIntervalSeconds>2</scanIntervalSeconds>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- Vaadin pre-release repositories -->
            <id>vaadin-prerelease</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>

            <repositories>
                <repository>
                    <id>vaadin-prereleases</id>
                    <url>http://maven.vaadin.com/vaadin-prereleases</url>
                </repository>
                <repository>
                    <id>vaadin-snapshots</id>
                    <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>vaadin-prereleases</id>
                    <url>http://maven.vaadin.com/vaadin-prereleases</url>
                </pluginRepository>
                <pluginRepository>
                    <id>vaadin-snapshots</id>
                    <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>

</project>

Tried following steps:

  • Deleted the npm modules, package.json, webpack.config.js, webpack.generated.js, target folders and ran mvn clean package

  • Ran mvn clean install

Tried solutions as in the links

Cannot find module '@vaadin/flow-frontend/Flow' https://vaadin.com/forum/thread/17762163/module-not-found# https://vaadin.com/forum/thread/17883890/webpack-error-can-t-resolve-vaadin-flow-frontend-flow-component-renderer

Nothing helped

Can you please give me leads on how to fix it?

Manushi
  • 597
  • 1
  • 7
  • 26
  • 1
    That probably doesn't solve your problem.. but you have multiple non-matching versions defined for Vaadin 8 (8.9.4, 8.7.0, 8.13.3) and Vaadin 14 (14.8.0, flow 6.0.4 and client 9.0.2) - having matching versions highly increases the change of successful compilation. – Knoobie Jan 03 '22 at 11:10
  • 2
    Yes, and to continue what @Knoobie started, Vaadin 14.8.0 requires to use Vaadin 8.14.3 with MPR due recent changes in framework to framework integration. You can find Flow version matching Vaadin 14.8.0 here https://github.com/vaadin/platform/releases/tag/14.8.0 – Tatu Lund Jan 03 '22 at 11:33

0 Answers0